Jump to content

No Arrays Vars?


Guest ScottD
 Share

Recommended Posts

Just installed AutoIt and am giving it a test drive. Very cool so far, however, I'm getting an error when trying to use array vars. This code from the help:

Dim $pos[4]

$pos = ControlGetPos("Untitled - NotePad", "", "Edit1")
MsgBox(0, "Window Stats:", "POS: " & $pos[0] & _
"," $pos[1] & " SIZE: " & $pos[2] & "," $pos[3] )

This gives me an error: Error: Subscript used with non-Array variable.

I've reinstalled AutoIt, but to no avail. What stupid little thing am I doing wrong?

Also, is there a way to click the currently active control, something like ActiveControlClick? Thanks for any help!

Link to comment
Share on other sites

it's not a problem with autoit, u jst don't have a window with the title "Untitled - NotePad" open...

and btw, the expression in the msgbox is wrong, u forgot few &'s. here's the fixed expression:

MsgBox(0, "Window Stats:", "POS: " & $pos[0] & _
"," & $pos[1] & " SIZE: " & $pos[2] & "," & $pos[3] )
Link to comment
Share on other sites

Your array indices look fine...

check the title "Untitled - NotePad"

I think the title is case sensitive and causes the ControlGetPos to fail. You should always check @error, or you could actually check IsArray($pos)

$pos = ControlGetPos("Untitled - NotePad", "", "Edit1")
MsgBox(4096,"info", "Error code: '" & @error)

$pos = ControlGetPos("Untitled - Notepad", "", "Edit1")
MsgBox(4096,"info", "Error code: '" & @error)
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...