Jump to content

Recommended Posts

Posted

I am new to AutoIt and I must say I am VERY, VERY impressed however I have one problem (at the moment) that I can't seem to figure out.

I want to find the x,y corrdinates of a string (it only appears once per form). This particular string happens to be on a button however if this makes things easier. Effectivly I would like to extract the X,Y values and then add a number to X since the object that I am looking for is always located a fixed distance from this button however the object changes so often that I would be impossible for me to script the action to the object itself.

Any help would be great

Thanks

Posted

Thanks but I seem to be having a problem

$pos = ControlGetPos("Form", "", "button1")
MsgBox(0, "Window Stats:", "POS: " & $pos[0] & "," $pos[1] & " SIZE: " & $pos[2] & "," & $pos[3] )

I get an error

"Subscript used with non array variable"

Shouldn't $pos be assigned as an array variable when it is defined as being equal to a function with 2 numbers?

Posted

$Pos[0] and $Pos[1] will only exist if there isn't an error with the function.

Try this...

$pos = ControlGetPos("Form", "", "button1")
If Not @Error Then
   MsgBox(0, "Window Stats:", "POS: " & $pos[0] & "," $pos[1] & " SIZE: " & $pos[2] & "," & $pos[3] )
Else
   Msgbox(0,"Error!", "@Error = " & @Error)
EndIf

qq

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
  • Recently Browsing   0 members

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