Jump to content

Recommended Posts

Posted

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

Posted

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 :)

 

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted (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 by Radish

Operating System: Windows 7 Pro. x64 SP1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...