Back to Script Function Reference

Set_CFG_Item()

The Set_CFG_Item() function can be used for manipulating configuration files. You can set single values, or keys and values with a specific delimeter. If you only need to set keys and values (in the form key=value), you can use the simpler Set_CFG_Value(). If you need to set values in a standard Windows INI file ([sections] containing key=value pairs), then you should use Set_INI_Value() instead.

Syntax

Set_CFG_Item(filenum/filename||key||delimiter||value)

Arguments

Argument Required Description
filenum/filename Yes The number of the file set in the script's associated files list that you want write to, or the absolute path\filename you want to write to. If you are using an absolute path\filename, any script environment variables found in filename will be replaced by their actual values when the script is executed.
key Yes The key within the configuration file that you want to set. Any script environment variables found in key will be replaced by their actual values when the script is executed.
delimiter No The character or set of characters to use as the delimeter between key and value. If this parameter is omitted (left blank) then a single space character will be used by default. Any script environment variables found in delimiter will be replaced by their actual values when the script is executed.
value No The desired value pertaining to key that you want to set. If this parameter is omitted (left blank) then only the key will be written to the ini file, without the delimiter or value. Any script environment variables found in value will be replaced by their actual values when the script is executed.


Examples

Set_CFG_Item(%emupath%\config.cfg||MODE||:||Windowed)

The line in the config file would look something like this: -
MODE:Windowed

Set_CFG_Item(1||$LOADPATH||%tab%||%gamepath%)

The line in the config file would look something like this: -
$LOADPATH c:\games

Set_CFG_Item(2||ControlPort2||||)

The line in the config file would look something like this: -
ControlPort2

Remarks

  • If the key cannot be found in the specified configuration file it will be created and set to the specified value (if supplied).
  • When the script is executed, a warning message will be displayed if the file cannot be found.

See Also


Navigation