Reading from INI file
How do I read the information from an ini file.
Example - The ini file is filled with notes and I want those notes to display in an edittext field as written in the ini file with spacing, numbers, letters, and separate lines if paragraphed as in the ini file.
edittext edtxtInfo "" fieldWidth:242 height:200 text:MyInfo pos:[0,4] MyInfo = GetINISetting "C:Desktop\trash\testingINI\Info.ini <code>
Comments
Shortly to say - all argument
Shortly to say - all argument to both get and set ini settings functions are strings --
GetINISetting "c:/fun.ini" "SectionName" "KeyName"
If you call the function to not existing file, or the section (or it key) is not found, the GetINISetting just return an empty string. Here is a test...
Although there are duplicate key names is stll a valid ini file, because this keys are in separate sections. Also no need Create/Open/Close for ini's, nor yet Find/Replace. Cool, ya :)
Also you can explore the ini file content (if needed) :) (very useful feature)
Well, if the ini was allows nested tree (as xml) would be the best format ever :))
hope this help
my recent MAXScripts RSS (archive here)
MyInfo = GetINISetting
MyInfo = GetINISetting "C:Desktop\trash\testingINI\Info.ini"
you should pay attention a slash, to ensure such:
MyInfo = GetINISetting "C:\Desktop\trash\testingINI\Info.ini" "dir" "subdir"
or by
"\\"
or by
"/"
or by
"//"
about the ""(a double quote in string) of "dir"(is section_string) "subdir"(is key_string ) that is example contents data in file.ini.
you can check in mxscript reference about that.
reading in file.INI contents like:
and that's like memory of 2 box objects in file.INI...
so do you understand it ? :)
Syntax
I am trying to save animationRange.end to an ini file, but cannot get the syntax correct for saving content data.
I have searched in the MAXScript reference but have been unable to put together the functional code.
Can you elaborate on the "double quote in string" bit you mentioned? Thank you so much!
what so unclear?
all parameters in both functions (getINISetting and setINISetting) are strings:
this example code will create a ini file (c:\test.ini) with this contents:
my recent MAXScripts RSS (archive here)