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 

Locating text and repositioning on it

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



Joined: 15 May 2009
Posts: 14
Location: Tulsa, OK

PostPosted: Fri May 15, 2009 3:56 pm    Post subject: Locating text and repositioning on it Reply with quote

Hey guys.. Not sure if this is possible. I searched through the archives and could not find the answers, so here I am.

I would like to sort through a lot of data in a website and find AND goto a specific word. I think I can locate the text with a WinGetText function, but I am not sure how I can scroll the page down to it. The purpose for this is to aid technicians reading telecom designs that are in an engineering layout. There is a specific section that the techs need in order to build out the logical designs.

I would like for them to be able to hit F6 and have AHK find the word "Logical" and then automatically scroll the page down so that Logical is on the top of the page. This would save them from sorting through a ton of irrelevant information.

Thanks for the help..

H
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Fri May 15, 2009 4:48 pm    Post subject: Reply with quote

Yuck...I hate those TridentDlgFrame boxes. I don't know if AHK can necessarily search the page itself but you could speed up the way IE searches it with AHK. For example:

Code:
F6::
SendMessage, 0x111, 67, 0, Internet Explorer_Server1, A ; opens the 'Find on this Page...' dialog box
WinWait, Find ; waits for the box to exist
Send {ALTDOWN}f{ALTUP} ; sends focus to the 'Find' field
Send Logical ; sends the text to the 'Find' field
Send{ALTDOWN}n{ALTUP} ; hits 'Next'
Send{ALTDOWN}{F4}{ALTUP} ; closes the 'Find on this Page...' dialog box
return


And you can of course condense all of the Sends to one statement:

Code:
F6::
SendMessage, 0x111, 67, 0, Internet Explorer_Server1, A
WinWait, Find
Send {ALTDOWN}f{ALTUP}Logical{ALTDOWN}n{ALTUP}{ALTDOWN}{F4}{ALTUP}
return


Hope that helps.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Hannibal_32



Joined: 15 May 2009
Posts: 14
Location: Tulsa, OK

PostPosted: Fri May 15, 2009 5:02 pm    Post subject: Reply with quote

I was hoping to not have to launch the typical find path, but it works well enough with your method. The only problem is that I want it to send {PgDn} after the find window is destroyed, but for some reason it won't work. Any ideas?

Code:

F6::
SendMessage, 0x111, 67, 0, Internet Explorer_Server1, A
WinWait, Find
Send Logical{enter}
sleep 100
Send {ALTDOWN}{F4}{ALTUP}
Send {PgDn}

return


Thanks as always, sinkfaze..

H
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 1121

PostPosted: Fri May 15, 2009 5:03 pm    Post subject: Reply with quote

Is there any reason you can't do this through the browser's built-in text find feature? For instance in Firefox, you could just:
Code:
Send ^fLogical
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Fri May 15, 2009 5:08 pm    Post subject: Reply with quote

I haven't found any good way to use anything other than the built-in search for IE but this method makes it work pretty quick. Might try this:

Code:
F6::
SendMessage, 0x111, 67, 0, Internet Explorer_Server1, A
WinWait, Find
Send Logical{enter}
sleep 100
Send {ALTDOWN}{F4}{ALTUP}
WinWaitClose, Find
Send {PgDn} ; or optionally "ControlSend, , {PgDn}, A"
return

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Hannibal_32



Joined: 15 May 2009
Posts: 14
Location: Tulsa, OK

PostPosted: Fri May 15, 2009 5:23 pm    Post subject: Reply with quote

Okay.. Your last method worked the best. I tried a combination of WinClose and some sleep values, but the WinWaitClose works most of the time. For some reason the Find window doesn't close out about 1 of 5 tries, which results in the pgdn not being sent until it's manually closed, but it's still a vast improvement over just using Alt+F5, typing it out, hitting enter, closing the window, and hitting pg dn. (That was to answer the previous query)..

Like I said, it hangs up about 20% of the time, but I can live with that.

Code:

F6::
SendMessage, 0x111, 67, 0, Internet Explorer_Server1, A
WinWait, Find
Send Logical{enter}
sleep 200
Send {ALTDOWN}{F4}{ALTUP}
WinWaitClose, Find
Send {PgDn}

return


Thanks again, Sinkfaze!

H
Back to top
View user's profile Send private message
Display posts from previous:   
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