Jump to content
Sign in to follow this  
victor

How to loop throught INI files to find value ?

Recommended Posts

victor

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

Share this post


Link to post
Share on other sites
Danny35d

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.