Dae Posted December 28, 2006 Posted December 28, 2006 I keep getting this error when trying to use the WinList "count of windows found" to determine the size of an array. The language reference says $g_Window[0][0] is a count of the amount of windows found. Which does seem true when using it in a For loop, but when used for an array it gives me an error: C:\WoW Roamer\v0.2\explorer.au3 (36) : ==> Array variable subscript badly formatted.: Dim $g_Account[$g_Window[0][0]][9] Dim $g_Account[^ ERROR Global $g_Window = WinList("classname=GxWindowClassD3d") Dim $g_Account[$g_Window[0][0]][9] For $i = 0 To $g_Window[0][0] $g_Account[$i][0] = $g_Window[$i][1] Next I tried replacing $g_Window[0][0] with $g_Count, and $g_Count = $g_Window[0][0]. But no go there. Can anyone help? Thanks
xcal Posted December 28, 2006 Posted December 28, 2006 I'm tired, so maybe I'm not getting it. But, are you just trying to copy the array to a new $var? If so, do this, otherwise, disregard. $g_Window = WinList("classname=GxWindowClassD3d") $g_Account = $g_Window How To Ask Questions The Smart Way
Dae Posted December 28, 2006 Author Posted December 28, 2006 I'm tired, so maybe I'm not getting it. But, are you just trying to copy the array to a new $var? If so, do this, otherwise, disregard. $g_Window = WinList("classname=GxWindowClassD3d") $g_Account = $g_Window I could do that, but you'll notice I switched the 1 in $g_Window for the 0 in $g_Account. Anyway, I don't want to do that because I might want to make $g_Account 3 dimensions later, and $g_Window is 2 dimensions. So I'm just copying over part of the data. I don't need all of the $g_Window, just part of it. I just want to why it's giving that error? Nothing's wrong from what I can see, except it complaining.
xcal Posted December 28, 2006 Posted December 28, 2006 No error with: Dim $g_Account[$g_Window[0][0]+1][9] How To Ask Questions The Smart Way
Dae Posted December 28, 2006 Author Posted December 28, 2006 (edited) No error with: Dim $g_Account[$g_Window[0][0]+1][9] Oh, right, thanks, sorry, I forgot theres actually no windows for WinList to pull because I'm not on my computer, so that probably doesn't exist. Should be 0, but I guess it's undefined. There's still an error though, and I don't think this one exceeds array bounds: Global $g_Account[1][5] For $id = 0 To UBOUND($g_Account) $g_Account[$id][0] = "Test"; $g_Account[$id][1] = "Halted"; status $g_Account[$id][2] = FALSE; run state Next C:\WoWRoamer\v0.2\explorer.au3 (38) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $g_Account[$id][0] = "Test" ^ ERROR Edited December 28, 2006 by Dae
Moderators SmOke_N Posted December 28, 2006 Moderators Posted December 28, 2006 (edited) For $id = 0 To UBOUND($g_Account) - 1 Edited December 28, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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