Sign in to follow this  
Followers 0
victor

How to loop throught INI files to find value ?

2 posts in this topic

#1 ·  Posted (edited)

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



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  
Followers 0