Sign in to follow this  
Followers 0
Dae

WinList Problem

6 posts in this topic

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

Can anyone help?

Thanks

Share this post


Link to post
Share on other sites



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

$g_Window = WinList("classname=GxWindowClassD3d")

$g_Account = $g_Window

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by Dae

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

For $id = 0 To UBOUND($g_Account) - 1

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0