Introduced in version 3.420, it is possible to address one inifile at a time: a few read and write operations are possible.
All read operations require that you specify a variable where to store the value, a Section (string, do not include the square brackets), a Key (string), and a default value for the case there in no such value in the inifile.
All write operations require that you specify a Section (string, no square brackets), a Key (string), and an appropriate value.
After you open an inifile and read from or write to it, you must close it with IniClose, otherwise the file remains open. An open inifile is closed when the script is terminated, but you should not wait for that.
IniOpen $f | Opens an inifile $f for read and write operations, or creates it. If an inifile has been opened and not closed by the script, this statement first closes the inifile. xelagot 3.607 or newer The filename convention is explained in the section Filenames. If the destination path and folder does not exist, it will be created to accommodate the file. xelagot 3.606 or older The file $f must be in the same folder as the script. |
IniClose | Closes an open inifile. Does nothing if no inifile is open. |
IniReadInt %v $section $key %default | Stores in %v the integer value from the inifile section/key or the default. |
IniWriteInt $section $key %v | Writes the integer value %v to the inifile section/key. |
IniReadBool %v section $key %default | Stores in %v an integer value from the inifile section/key or the default. The value 0 corresponds to false, otherwise 1 is stored. |
IniWriteBool $section $key %v | Writes the value %v to the inifile section/key. If %v is 0, the boolean is false, else it is true (reperesented by the number 1 in the inifile). |
IniReadFloat %v $section $key %default | Stores in %v the real (float) value from the inifile section/key or the default. |
IniWriteFloat $section $key %v | Writes the real (float) value %v to the inifile section/key. |
IniReadString $s $section $key $default | Stores in $s the string value from the inifile section/key or the default. |
IniWriteString $section $key $s | Writes the trimmed (leading and trailing spaces removed) value of $s to the inifile section/key. |