
Announcement
Collapse
No announcement yet.
Need help in with .ini file
Collapse
X
-
Im gonna presume the 3 value you want to add are called NameA, NameB and NameC.
Have three boolean variables declared at the top of your script:
Code:bAddNameA = true bAddNameB = true bAddNameC = true
Code:if valuenames == NameA then bAddNameA = false end if valuenames == NameB then bAddNameB = false end if valuenames == NameC then bAddNameC = false end
At the bottom of the script add:
Code:if bAddNameA = true then -- Add the value for NameA here. end if bAddNameB = true then -- Add the value for NameB here. end if bAddNameC = true then -- Add the value for NameC here. end
So if any/or all of the values already exist then the booleans will be set to false and the "adding" script wont be run. Otherwise if they dont exist it will run.
Hope this helps
Leave a comment:
-
-
Need help in with .ini file
Hi,
I am new to AMS. I need suggestion for manipulating a .ini file.
I need to find if a .ini file exists, if it exists, need to look for 3 names [field] in a particular section, if any one of the names[fileds] doesnt exists then i need to update the file with the missing name.
I am able to find the file and the section and also the names, but not sure how to check the name[fields] doesnt exist.
Below is my code. Please advice.
Code:if File.DoesExist(OptimPath.."\\cntlpack\\print.INI") then all_sections = INIFile.GetSectionNames(OptimPath.."\\cntlpack\\print.INI"); for index_section, section in pairs(all_sections) do if section == "IRD PRINT PARAMETERS" then value_names = INIFile.GetValueNames(OptimPath.."\\cntlpack\\print.INI", section); for index_section, valuenames in pairs(value_names) do [COLOR="red"]--Need to do the logic. try to find the name, if not exisit, enter the name [/COLOR] end end end end
Leave a comment: