Jump to content

Error Message is Wrong?


Recommended Posts

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

  • Moderators

$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

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