smokeys13 Posted January 30, 2010 Share Posted January 30, 2010 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 More sharing options...
whim Posted January 30, 2010 Share Posted January 30, 2010 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 More sharing options...
Yashied Posted January 30, 2010 Share Posted January 30, 2010 (edited) Can be done as follows. $step1 = IniReadSection("config.ini", "step 1") For $i = 1 To $step1[0][0] ... Next Edited January 30, 2010 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
smokeys13 Posted January 30, 2010 Author Share Posted January 30, 2010 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... All is now working as planned, thanks again for your help! Link to comment Share on other sites More sharing options...
JohnOne Posted January 30, 2010 Share Posted January 30, 2010 (edited) $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 January 30, 2010 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 More sharing options...
smokeys13 Posted January 30, 2010 Author Share Posted January 30, 2010 $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. No problems, thanks for replying anyway. In fact, your reply has brought "@error" to my attention so thank you for that! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now