Jump to content
Sign in to follow this  

find coordinates of text on screen

Recommended Posts


Greetings! I am new to this forum, and to AutoIt as well. I have found that the programming seems to be very straight forward, and usually with a little trial and error I can figure out whatever i need to, However...

There is one feature that SHOULD be available, or at least a feasible work around should be available. AutoIt was created to automate windows tasks. There are many programs (especially now) that utilize different methods of interacting with the user, and even if a specific control is not available, there should be a way to identify a specific location on the screen, then allow the program to "click", etc...

That being said, I am continually running into programs that have no set controls, and no keyboard commands. This means the mouse is the only option of I/O. There is a command that allows the program to identify some text from the window... and much of that text is associated with where you need to "click". There is also a command that allows you to see the x,y index of the mouse cursor. What there does not seem to be, is a command that will find a single instance of text, and return the location of that text's coordinates.

I have heavily "googled" this topic, and I have also searched the threads here. One example here ends up providing different solutions for a different problem, and the other seems to rally around an unknown dll file that must be installed on the machine (as well as no clear examples of what to actually do with it to find text).

Does ANYONE know how ( not theory, and not lecture :unsure: ) to locate a word on the screen (that the program already can find) like "SETTINGS" and find it's x,y coordinates so I can move the mouse there, and click.

Any help would be greatly appreciated!

FYI: I know that I could use the recorder or the reader to find the position, and as long as the program is used on this computer, using this screen resolution that would be fine... but any minute differences and I could end up configuring the wrong setting, wiping my hard drive, who knows?

Edited by zthaynes

Share this post

Link to post
Share on other sites

u could use ControlClick()

an example:

 $input=GUICtrlCreateInput("this is the text",0,0)
 $button=GUICtrlCreateButton("this is a button",0,50)
 $combo=GUICtrlCreateCombo("combo text",0,150)
 While 1 
    ControlClick("","",$input)                           ;<===== you can use the variable if you have predefined the control, however it will not work in other programs 
    ControlClick("","","[CLASS:ComboBox; INSTANCE:1]")   ;<===== you can use the autoit information tool to figure this out so you can use it outside of your program

notice how the gui is looping through clicking the buttons, which is why they are flashing

[spoiler]My UDFs: Login UDF[/spoiler]

Share this post

Link to post
Share on other sites

Maybe I didn't explain well enough... I do tend to ramble a bit. One program that I want to automate install is Stardock's Object Dock. to go into settings, you would:

run("c:\program files\stardock\objectdockfree\objectdockui.exe")

Once this program is up, I want to do something like this (!!!I know this isn't how to do it!!!)

;array[2] = x,y coordinates for the text "settings"
$xycord[2] = {WinGetText("","Settings")}

;left click the mouse at the coordinates

I cannot tab through controls, nor can I identify them through the window info tool. There are none, only links embedded into the program. Now... The text "Settings", as well as other commands are shown in the window info tool, so I know there is text to find...

Share this post

Link to post
Share on other sites

If the window is always the same size, then you could use WinGetPos and hardcode the coordinates.

Share this post

Link to post
Share on other sites

Searching the forum for the very same question, I came upon this post. Unfortunately, the question remains unresolved.

Any fresh input into a solution would be greatly appreciated by myself and the original poster, I am sure.


Share this post

Link to post
Share on other sites

I have this exact same question! I've also spent countless hours searching for a solution to this question. I've implemented workarounds, but it would be great to have a straightforward solution!

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