Jump to content
Sign in to follow this  
Guest ScottD

No Arrays Vars?

Recommended Posts

Guest ScottD

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!

Share this post


Link to post
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] )

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites
Guest ScottD

Thanks, guys. A couple extra ampersands and a lower-case 'p' did the trick. :">

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...