CygnusX1 Posted March 15, 2008 Share Posted March 15, 2008 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 Link to comment Share on other sites More sharing options...
Tzackel Posted March 15, 2008 Share Posted March 15, 2008 Maybe it gets an error once in a while and sets $aPos to 0 thus no longer an array Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2008 Moderators Share Posted March 15, 2008 $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. Link to comment Share on other sites More sharing options...
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