Radish Posted July 23, 2018 Share Posted July 23, 2018 Hi. I have a simple question. I have an ini file that contains two lines: dataFolder=E:\PORTABLES\- AutoIT Scripts\data\ tempFolder=E:\PORTABLES\- AutoIT Scripts\temp\ I tried using iniRead and iniWrite to manipulate the data content of those lines in the ini file. It seems it failed because I hadn't entered in a [SectionName]. I did try just entering "" as the SectionName (my intended meaning being that there was no section under which those keys would be found. Doing this failed. In the end I had to enter a SectionName into the ini file, and specify that in the script, and then things worked. Happy I got it working but I have this question: Is there any way to use iniRead and iniWrite without specifying a SectionName? (Just in case I'm missing something obvious.) Operating System: Windows 7 Pro. x64 SP1 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 23, 2018 Share Posted July 23, 2018 From the INI Wiki file format Wiki: Keys may (but need not) be grouped into arbitrarily named sections. The section name appears on a line by itself, in square brackets ([ and ]). All keys after the section declaration are associated with that section. There is no explicit "end of section" delimiter; sections end at the next section declaration, or the end of the file. Sections may not be nested. As you can see, Sections are "optional", even if, in the standard INI format, they are used. I think that IniWrite() and IniRead() are two functions which have been created to manage INI files in their standard format. So, if you don't want to use them as they are usually used, use FileWrite() and FileRead() to access the file Radish 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Radish Posted July 23, 2018 Author Share Posted July 23, 2018 (edited) Thanks for that, Francesco. I'm more informed now about what the specifications are for section names in an ini file. I'll take it that this means that when using iniRead and iniWrite the use of section names in the script is mandatory. Edited July 23, 2018 by Radish Operating System: Windows 7 Pro. x64 SP1 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 24, 2018 Share Posted July 24, 2018 Happy to have helped Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now