Back to [[.:|Script Function Reference]] ====== Set_INI_Value() ====== The Set_INI_Value() function can be used for manipulating Windows INI files. If you need to set values in //[sections]// containing //key=value// pairs, then this is the function you need. If you only need to set keys and values (in the form //key=value//), you can use the simpler [[.:set_cfg_value|Set_CFG_Value()]]. If you need more control, see [[.:set_cfg_item|Set_CFG_Item()]]. ===== Syntax ===== Set_INI_Value(filenum/filename||section||key||value) ===== 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. | | //section// | Yes | The desired [section] within the INI file where you want to set the value. Any [[..:environment_variables|script environment variables]] found in //section// will be replaced by their actual values when the script is executed. You should not surround //section// in square brackets. | | //key// | Yes | The key within the //section// of 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 of //key// within //section// of the configuration file. Any [[..:environment_variables|script environment variables]] found in //value// will be replaced by their actual values when the script is executed. | \\ ===== Examples ===== Set_INI_Value(%emupath%\config.ini||Config||LoadPath||%gamepath%) This might have the following effect in the INI file: -\\ [Config]\\ LoadPath=c:\games Set_INI_Value(4||Control||JoystickPort||2) This might have the following effect in the INI file: -\\ [Control]\\ JoystickPort=2 ===== Remarks ===== * If the key cannot be found in the configuration file it will be created within the specified section and set to the desired 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_cfg_value|Set_CFG_Value()]] * [[.:|Script Function Reference]]