Vladi243 Posted June 27, 2008 Share Posted June 27, 2008 Hey, I read in the help file about the function IniReadSection(). I can't understand how it's working. There is written that the element[n][0] obtains the key and the element[n][1] obtains the value. I realy don't understand it. I tried to obtain them, but it's not working. Can someone explain it to me with example? Thanks. Link to comment Share on other sites More sharing options...
AustrianOak Posted June 27, 2008 Share Posted June 27, 2008 Make sure with IniReadSection() you use a loop, because $element[n] is the counting variable,And the example in the helpfile looks fine to me...$var = IniReadSection("C:\Temp\myfile.ini", "section2") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) Next EndIfIt reads [section2] in the .ini on the first line. then after checking for an error, it starts at 1 and from 1 To $var[0][0] it counts the number of elements returned.From helpfile: The number of elements returned will be in $result[0][0]. Then in the msgbox() it uses the counting variable $i with either [0] or [1] to show the current key or value.I hope I was clear enough. Link to comment Share on other sites More sharing options...
rudi Posted June 27, 2008 Share Posted June 27, 2008 Hi. Edit the sample to point to your ini and the section you want to read. #include <array.au3> $YourIni=@WindowsDir & "\system.ini" ; replace $YourSection="386enh" ; replace $IniArray=IniReadSection($YourIni,$YourSection) _ArrayDisplay($IniArray) regards, rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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