Jump to content

If Not and If $var <> stuff not working


Recommended Posts

Hi,

I'm trying to loop through the keys under the specified section of my .ini file.

"config.ini"

[step 1]
down=3
char=m

"test.au3"

$step1 = IniReadSection("config.ini","step 1")

$i = 1
$keys = 0


While $step1[$i][0] + 1 == 1
    $keys = $keys + 1
    MsgBox(0,"keys",$keys)
    $i = $i + 1
WEnd


MsgBox(1,"my title",$keys)

As you can tell this is basically a way for me to decipher how many keys are stored under the specified section.

After the second msgbox has appeared displaying "2" the script ends saying " WEnd^ ERROR ".

I therefore decided to put "If $step1[$i][0] + 1 <> 1 Then ExitLoop" and "If Not $step1[$i][0] + 1 == 1 Then ExitLoop" before WEnd but neither validated.

Any help would be greatly appreciated

Link to comment
Share on other sites

Unless i misunderstood the help file ("Function IniReadSection: The number of elements returned will be in $result[0][0]. ")

your array $step[0][0] should contain the number of keys in your ini section

hth,

whim

Link to comment
Share on other sites

Link to comment
Share on other sites

$step1 = IniReadSection("config.ini","step 1")
If Not @error Then Msgbox(0,"Return", "Amount of keys =" & $step1[0][0])

EDIT: sorry, got distracted and didnt notice you had your answer.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...