Sign in to follow this  
Followers 0
CygnusX1

Error Message is Wrong?

3 posts in this topic

Hey,

I'm trying to move a floating toolbar which I can do sometimes and sometimes I get an error message. I don't know why. The help says that WinGetPos returns an array of the window. I'm trying to use the elements of the array to move the floating toolbar to a different part of the screen and I'm getting an error message.

Subscript used with non-Array variable.

Here is the code I'm using.

$aPos = WinGetPos($sMeasurements); gets the upper left hand corner x, y of the floating measurments toolbar in an array

$x = $aPos[0]
$y = $aPos[1]
    
MouseMove($x + 30, $y + 10)

MouseClickDrag("left", $x + 30, $y + 10, 0, 750)

Isn't $aPos an array?

In something languages like Ruby you can do

object.class

To get the class of the object

Is there something I can do to verify that $aPos is an array or a different variable?

Thank you.

Cygnus


Cygnus

Share this post


Link to post
Share on other sites



Maybe it gets an error once in a while and sets $aPos to 0 thus no longer an array

Share this post


Link to post
Share on other sites

$aPos = WinGetPos($sMeasurements); gets the upper left hand corner x, y of the floating measurments toolbar in an array
If IsArray($aPos) Then
    $x = $aPos[0]
    $y = $aPos[1]
;Not necessary: MouseMove($x + 30, $y + 10)
    MouseClickDrag("left", $x + 30, $y + 10, 0, 750)
Else
    MsgBox(16, "Error", "Better check your Window is not minimized or hidden ;)")
EndIf


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.

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