User Tools

Site Tools


gemus_script_reference:functions:set_cfg_value
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Last revision
gemus_script_reference:functions:set_cfg_value [2020/05/12 11:28] – created Jimbo
Line 1: Line 1:
 +Back to [[.:|Script Function Reference]]
  
 +====== Set_CFG_Value() ======
 +
 +The Set_CFG_Value() function can be used for manipulating configuration files by setting //key=value// pairs. If you need more control over what is written to the configuration file, see [[.:set_cfg_item|Set_CFG_Item()]]. If you need to set values in a standard Windows INI file (//[sections]// containing //key=value// pairs), see [[.:set_ini_value|Set_INI_Value()]].
 +
 +===== Syntax =====
 +
 +<code>Set_CFG_Value(filenum/filename||key||value)</code>
 +
 +===== Arguments =====
 +
 +^ Argument ^ Required ^ Description ^
 +| //filenum/filename// | Yes | The number of the file set in the script's [[..:associated_files|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 [[..:environment_variables|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 [[..:environment_variables|script environment variables]] found in //key// 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. Any [[..:environment_variables|script environment variables]] found in //value// will be replaced by their actual values when the script is executed. |
 +\\ 
 +
 +===== Examples =====
 +
 +<code>
 +Set_CFG_Value(%emupath%\config.cfg||$LOADPATH||%gamepath%)
 +</code>
 +The line in the config file would look something like this: -\\ 
 +$LOADPATH=c:\games
 +
 +<code>
 +Set_CFG_Value(4||MODE||Windowed)
 +</code>
 +The line in the config file would look something like this: -\\ 
 +MODE=Windowed
 +
 +<code>
 +Set_CFG_Value(4||MODE||)
 +</code>
 +The line in the config file would look something like this: -\\ 
 +Mode=
 +
 +===== Remarks =====
 +
 +  * If the key cannot be found in the specified configuration file it will be created and set to the specified value.
 +  * When the script is executed, a warning message will be displayed if the file cannot be found.
 +
 +===== See Also =====
 +
 +  * [[.:set_cfg_item|Set_CFG_Item()]]
 +  * [[.:set_ini_value|Set_INI_Value()]]
 +  * [[.:|Script Function Reference]]
gemus_script_reference/functions/set_cfg_value.txt · Last modified: 2023/10/04 14:15 by 127.0.0.1