AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is there a way to search for a word in a window

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
elkhorntommy



Joined: 06 Dec 2007
Posts: 7
Location: Tennessee

PostPosted: Thu Dec 06, 2007 1:24 am    Post subject: Is there a way to search for a word in a window Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Dec 06, 2007 1:31 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
elkhorntommy



Joined: 06 Dec 2007
Posts: 7
Location: Tennessee

PostPosted: Thu Dec 06, 2007 1:38 am    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Dec 06, 2007 1:42 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
elkhorntommy



Joined: 06 Dec 2007
Posts: 7
Location: Tennessee

PostPosted: Thu Dec 06, 2007 1:48 am    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Dec 06, 2007 2:02 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
elkhorntommy



Joined: 06 Dec 2007
Posts: 7
Location: Tennessee

PostPosted: Thu Dec 06, 2007 2:14 am    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Dec 06, 2007 2:15 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
elkhorntommy



Joined: 06 Dec 2007
Posts: 7
Location: Tennessee

PostPosted: Thu Dec 06, 2007 2:18 am    Post subject: Reply with quote

Same here. Probably more trouble than its worth for what I want to do. Thanks anyway.
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Dec 06, 2007 2:48 am    Post subject: Reply with quote

last ditch: adapt http://www.autohotkey.com/forum/viewtopic.php?t=25473

or see if iMacros can do it.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
svi



Joined: 09 Oct 2006
Posts: 124
Location: Finland

PostPosted: Thu Dec 06, 2007 10:12 pm    Post subject: Reply with quote

Maybe too obvious (in order) to help anyone Confused, 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
View user's profile Send private message
elkhorntommy



Joined: 06 Dec 2007
Posts: 7
Location: Tennessee

PostPosted: Fri Dec 07, 2007 4:57 am    Post subject: Reply with quote

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
View user's profile Send private message
svi



Joined: 09 Oct 2006
Posts: 124
Location: Finland

PostPosted: Fri Dec 07, 2007 10:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group