| View previous topic :: View next topic |
| Author |
Message |
elkhorntommy
Joined: 06 Dec 2007 Posts: 7 Location: Tennessee
|
Posted: Thu Dec 06, 2007 1:24 am Post subject: Is there a way to search for a word in a window |
|
|
| This may be so easy I'm overlooking the obvious. Basically, I need to know if the word error is anywhere in a given window. I found the script that speaks starting where the cursor was located, but was unclear on how the string it speaks was built. If I could get the words from a displayed window in a string, I can take it from there. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Dec 06, 2007 1:31 am Post subject: |
|
|
WinGetText?
it depends on the window. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
elkhorntommy
Joined: 06 Dec 2007 Posts: 7 Location: Tennessee
|
Posted: Thu Dec 06, 2007 1:38 am Post subject: |
|
|
| No, it's not text as I understand text. For example, WinGetText works fine if I type a word in notepad. What I'm looking for is a word that is displayed somewhere in a window. I hope I'm making sense! |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Dec 06, 2007 1:42 am Post subject: |
|
|
what window? It all depends on the window. If the Aui_IT Spy tool that came with AHK can see it, then AHK can see it. if not, you have more work to do. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
elkhorntommy
Joined: 06 Dec 2007 Posts: 7 Location: Tennessee
|
Posted: Thu Dec 06, 2007 1:48 am Post subject: |
|
|
| No, the (expletive deleted)Spy Tool does not see it. The window is just one that logs connections to a server every minute. It an error occurs it says something like error connecting but does nothing else for you. I know the name of the window to activate so that is not a problem. I have no control over the logging program but if I could check it every minute or so and look for the word error that would be the trigger I need. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Dec 06, 2007 2:02 am Post subject: |
|
|
is it a command line program? can you start it with CmdRet or something so you can get the text directly to AHK?
Others may have some better ideas.
Worst case = OCR. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
elkhorntommy
Joined: 06 Dec 2007 Posts: 7 Location: Tennessee
|
Posted: Thu Dec 06, 2007 2:14 am Post subject: |
|
|
No, it's not a cmd line. Maybe a better example would be this. Looking at your last post, how using AHK could you determine if the word CmdRet was showing on you screen. Similar to using the find option under Edit.
Last edited by elkhorntommy on Thu Dec 06, 2007 2:17 am; edited 1 time in total |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Dec 06, 2007 2:15 am Post subject: |
|
|
for me it is in a firefox window, so much more difficult. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
elkhorntommy
Joined: 06 Dec 2007 Posts: 7 Location: Tennessee
|
Posted: Thu Dec 06, 2007 2:18 am Post subject: |
|
|
| Same here. Probably more trouble than its worth for what I want to do. Thanks anyway. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
|
| Back to top |
|
 |
svi
Joined: 09 Oct 2006 Posts: 124 Location: Finland
|
Posted: Thu Dec 06, 2007 10:12 pm Post subject: |
|
|
Maybe too obvious (in order) to help anyone , but :
For some windows (inlcuding browsers) you can just send Ctrl-a Ctrl-c (or even only Ctrl-c) to copy text, but if the control is bigger than the area reserved for it (a scrollable window), how to (simply) determine if the relevant text is currently seen? _________________ Pekka Vartto |
|
| Back to top |
|
 |
elkhorntommy
Joined: 06 Dec 2007 Posts: 7 Location: Tennessee
|
Posted: Fri Dec 07, 2007 4:57 am Post subject: |
|
|
| Actually, what you suggested works most of the time. However, for some strange reason the particular window I'm trying to pull the text from ignores the CTRL-a and CTRL-c. Thanks for the suggestion. |
|
| Back to top |
|
 |
svi
Joined: 09 Oct 2006 Posts: 124 Location: Finland
|
Posted: Fri Dec 07, 2007 10:16 pm Post subject: |
|
|
ImageSearch could find the word, if (the window is not under some else window and) the word is always wholly in the same line, ie. not:
er-
ror
or
err-
or
(hardly ever).
Addition: | Wikipedia wrote: | | Examples occurring in Received Pronunciation include words such as arrow [ˈærəʊ], error [ˈerə], mirror [ˈmɪrə], borrow [ˈbɒrəʊ], burrow [ˈbʌrəʊ], which can't be divided into separately pronounceable syllables |
_________________ Pekka Vartto |
|
| Back to top |
|
 |
|