FinalVersion Posted February 12, 2010 Share Posted February 12, 2010 $rsn = IniReadSectionNames(@ScriptDir & "\Data.ini") $rsn_count = UBound($rsn) -1 For $i = 1 To $rsn_count $rs = IniReadSection(@ScriptDir & "\Data.ini", $rsn[$i]) Next $rs_count = UBound($rs) -1 For $x = 1 To $rs_Count MsgBox(0, "a", $rs[$x]) Next I've exhausted everything I can think of, and nothing worked.' Data.ini [Client1] Name=John Age=24 [Client2] Name=Ted Age=30 Error C:\Users\Scott\Documents\AutoIt\Hmm.au3 (12) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: MsgBox(0, "a", $rs[$x]) MsgBox(0, "a", ^ ERROR [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 Zero is the count, so basically you could go. For $x = 1 To $rs[0] [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 12, 2010 Share Posted February 12, 2010 (edited) when you set the values of $r it makes an multi-dimentional array. #include <array.au3> $rsn = IniReadSectionNames(@ScriptDir & "\Data.ini") $rsn_count = UBound($rsn) -1 For $i = 1 To $rsn_count $rs = IniReadSection(@ScriptDir & "\Data.ini", $rsn[$i]) Next _arraydisplay($rs) $rs_count = UBound($rs) -1 For $x = 1 To $rs_Count MsgBox(0, "a", $rs[$x][0]) ; added [0] here to get the values from the first column Next What values are you trying to retreive? Just the name? Age? or everything from each "Client" Edited February 12, 2010 by Steveiwonder They call me MrRegExpMan Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 (edited) Everything from each client. Sort of like $rs[1][1] would be John 24, [2][2] Ted 30 etc. Edited February 12, 2010 by FinalVersion [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 12, 2010 Share Posted February 12, 2010 (edited) Works for me. I think two seperate arrays one for age/name works better keeps it easier to read and you can add more values (arrays) and it doesn't look even messier #include <array.au3> $rsn = IniReadSectionNames(@ScriptDir & "\Data.ini") Local $clientName[$rsn[0]] ; sets array the size of $rsn Local $clientAge[$rsn[0]] ; sets array the size of $rsn For $i = 1 To $rsn[0] $clientName[$i-1] = IniRead(@ScriptDir & "\Data.ini", $rsn[$i], "Name", "Key Not Found"); enter client name into array $clientAge[$i-1] = IniRead(@ScriptDir & "\Data.ini", $rsn[$i], "Age", "Key Not Found")enter client age into array Next #cs $clientName[0] $clientAge[0] These are matching to each other as are $clientName[1] $clientAge[1] #ce For $i = 0 to $rsn[0] Msgbox(0, "Client Info", "Client Name: " & $clientName[$i]& @CR & "Client Age: " & $clientAge[$i]) Next Edited February 12, 2010 by Steveiwonder They call me MrRegExpMan Link to comment Share on other sites More sharing options...
FinalVersion Posted February 12, 2010 Author Share Posted February 12, 2010 Ok thanks, solved yet another one of my problems. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] 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