Jump to content
Macro Express Forums

Ability to locate a specific text field within a window and click on it. (text field is not in a static position)

Recommended Posts

I have captured the Current Screen in the clipboard.  I need to search for a specific text and then click on it.  The problem is that I have encountered a window where depending on messages in the screen, the specified text can move down.  It is not in a static location.  My current process does a clipboard copy to a %var%  and then I If variable %var% contains the text and then I process it by statically moving the cursor.  But now that it moves around, I have a problem.


Would like the ability to search for the text in the Current Window and have it return the location so that I can left click, or left double click.  (It would be nice if there was a parameter that called for occurrence, i.e." 2" for the second occurrence of the text, defaulting to 1)


Is there a current way to do this?  Or could this feature be added to a new release.


Thank You.

Link to comment
Share on other sites

I've built scripts that search for text adjacent to a field I want to focus. Then the script tabs or (Shift+Tab) to the target. In pseudo code....


Type "Control+F"          // Find on the page. In some applications, you can use F3.

Wait a split second

Type "City:"                  // Unique text near the field I want to get to

Type "{Enter}"              // Initiate the search

Type "{Esc}"                // Cancel the search

Wait a split second

Type "{Tab}{Tab}"      // Navigate to the field i want to reach


This approach is fussy. It takes trial and error to get the timing right, and to work out what text to search for. But with effort, I can usually get it to work almost 100% of the time.

Link to comment
Share on other sites

Like acantor said. 

Also, sometimes you can search for text within a button that can be either clicked or activated with the ENTER key.  For example, the snippet below logs me out of several web sites:


    Text Type (Simulate Keystrokes): <HOME>
    Text Type (Simulate Keystrokes): <CTRLD>f<CTRLU>log out<ESC>
    Delay: 250 milliseconds
    Text Type (Simulate Keystrokes): <ENTER>


It would be handy if there were a browser operation to find text AND automatically position the mouse over that text.  

Link to comment
Share on other sites

Firefox has a search-links-only feature which I've used instead of Ctrl + F to reduce search volume.


The feature is helpful in another situation: If a string appears many times on a page, but only once as part of a hypertext link, search-links ensures the script zeros in on the link.


The hotkey for search-links in Firefox is the open single quote character. That's a problem. If focus is in an editable field, the hotkey fails; instead the hotkey inserts the single quote character. (Maybe there's a way to change the hotkey to Ctrl + something, which would allow feature to work in more contexts.)


Strangely, the feature appears to be absent in Chrome and Edge.

Link to comment
Share on other sites

  • 3 months later...

Thanks to you guys for the information and advice...


I have spent the last 24 hours learning the windows and tab.  


I was able to get rid of a lot of the mouse move commands...



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...