Sign in to follow this  
Followers 0
boogieoompa

Find String Location on Screen

4 posts in this topic

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

Share this post


Link to post
Share on other sites



try using the AutoIt Window Info tool to get the control id

for exampel "Button1"

then use ControlGetPos ( "title", "text", controlID )

to get the x, y coords of the button

these are in the help.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

$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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

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