An INI File is a pure ASCII Text file typically used to store settings of User Interface states or any arbitrary information. The data is organized in Categories containing any number of Keys and corresponding Values.
MAXScript provides a very error-tolerant set of functions to manage INI Files. For example, setting a new category and key in an non-existent INI file will automatically generate a new file without the need for any additional management function calls. Getting a non-existent key value from an existing file or even from a non-existent file will return an empty string without causing an error and so on.
Reads an INI setting from the specified file. Within the file, the section identified by <section_string> is located, and then the key specified by the <key_string> is located.
The value assigned to this key is then returned as a string.
If the specified file, section, or key is not found, an empty string "" is returned.
In 3ds Max 6 and higher, if only the .ini file is specified, the method will return an array of the sections in the .ini file.
In 3ds Max 6 and higher, if only the .ini file and section are specified, the method will return an array of the keys in the section.
setINISetting <filename_string> <section_string> <key_string> <key_value_string> [ forceUTF16:<boolean> ]
Sets an INI setting in the specified file.
Returns a value of true if the key value was written to the file, false if the key was not written.
Within the file, the section identified by <section_string> is located, and then the key specified by the <key_string> is located.
The <key_value_string> is then assigned to this key.
If the specified file, section, or key is not found, a new file, section, or key is created.
If the specified file is read-only, or the file is open in MAXScript, the key value is not written to the file.
The optional forceUTF16: keyword argument available in 3ds Max 2013 and higher controls whether the value is written using UTF16 encoding or as ASCII text.
By default, when the optional keyword argument is not supplied, or is supplied as true, UTF16 encoding will be used.
If the optional keyword is provided as false, the value will be written as ASCII text.
An additional method available in 3ds Max 2013 and higher controls the default behavior of the forceUTF16: optional keyword argument when it is not supplied:
<bool>setIniForceUTF16Default <bool>
After a fresh start, the forceUTF16: keyword argument's default value is true.
Calling setIniForceUTF16Default false will set the default encoding of the setINISetting() method to ASCII.
Calling setIniForceUTF16Default true will set the default encoding of the setINISetting() method to UTF16.
The default behavior is not sticky between sessions, after a restart it will revert back to forceUTF16: default encoding.
Deletes the specified key from the supplied section of the given INI file.
Deletes the section and all keys in the section of the given INI file.
Returns true if the INI setting exists in the specified file.
This method is available in 3ds Max 2008 and higher.
Within the file, the section identified by <section_string> is located, and then the key specified by the <key_string> is tested for.
If <key_string> is not specified, the section specified by <section_string> is tested for.