This might be a hard problem: locate a word on the screen and highlight it. In ANY type of window (adobe acrobat, a browser, MS word...).
This problem has three parts1 - getting a reliable text dump
A 'hacky' approach would be to click on the area that displays text, send ctrl a + ctrl c, put that into the clipboard and the operate from there. This is application-general. Nice. A (maybe) cleaner approach would be to write rules for each application to save a text dump (e.g., sending the kb shortcuts for 'save as', 'export' etc depending on each application. It'd generate spaghetti code
, not very elegant
I can see that AutoIT windows spy drops two interesting pieces of information under:
>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
However this is most of the time uninteresting information such as the name of the controls, buttons, etc, nowhere near the full text dump that I'm thinking about.
A similar approach -anything out there that does like autoIT spy but grabs all text in a window?- would be an elegant solution...2 - finding the word in the text dump
Here one may need some interesting algorithms for cases where the word appears more than once. To simplify, pick the first occurence.3- locate the word in the native application! (hard!)
The only application-general way of doing this to do an OCR of a screen-capture of the text area, and then use some proprietary (all decent OCR libraries are proprietary
) function call to find the coordinates of that word. then draw a circle on top to highlight it...
Am I overcomplicating things? Do you have any tricks/hacks to solve this problem?
(PS: I have posted this in the ahk forum, as I'm using ahk to quickly get a mockup working...)