Jump to content

How to loop throught INI files to find value ?


victor
 Share

Recommended Posts

I wrote this but it doesn't work ... why ?

-----------------------------------

$var2 = 400

$var = IniReadSectionNames("myfile.ini")

If @error Then

MsgBox(4096, "", "Error occured, probably no INI file.")

Else

For $i = 1 To $var[0]

if IniRead ( "myfile.ini", "$var[$i]", "weight", "default" ) == $var2 Then MsgBox(4096, "", "yes it works")

MsgBox(4096, "", $var[$i])

Next

EndIf

--------------------------------------

myfile.ini

-----------------------

[links]

height=400

weight=400

[links2]

height=402

weight=402

Edited by victor
Link to comment
Share on other sites

At this line remove the qouts...

if IniRead ( "myfile.ini", "$var[$i]", "weight", "default" ) == $var2 Then MsgBox(4096, "", "yes it works")

it should be like this

if IniRead ( "myfile.ini", $var[$i], "weight", "default" ) == $var2 Then MsgBox(4096, "", "yes it works")

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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