Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

Thanks for your prompt replies, I'm going to just use $step1[0][0] - thanks for pointing that out to me, I feel a bit stupid for not reading further down the help file now though... :D

All is now working as planned, thanks again for your help!

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
×
×
  • Create New...