 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
vital
Joined: 05 Oct 2005 Posts: 17 Location: china
|
Posted: Sat Oct 15, 2005 4:33 am Post subject: can a function detect when a web page is finished loading? |
|
|
would you add a function only with a url parameter to detect when a web page is finished loading ? i know Macro Express 3 can do it.
A certain page is framed, then the "done" text appears in the statusbar several times, it is trouble to deteck when the page is finished loading. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sat Oct 15, 2005 8:25 am Post subject: |
|
|
| I don't know how to do it currently, but I've made a note to research it. Thanks for the idea. |
|
| Back to top |
|
 |
AHKnow* Guest
|
Posted: Tue Oct 18, 2005 2:18 am Post subject: |
|
|
I would also like to add, that I would liked to see this too.
The problem with "Done" at the bottom of many web pages/status bar is that the web page is often not really done loading. "Done" can show up even several times in the process of the web page loading.
I've done stuff like:
| Code: |
SetTitleMatchMode, 1
SetTitleMatchMode, Slow
ControlClick, whatevercontrolau3spyfinds, whateverwebpage,,right,1 ; right click web page
Send, v ; view page source
Winwait, Title[1] - Notepad ; opens when viewing page source
Send, ^A ; select all shown in notepad
Send, ^C ; copy all shown in notepad to clipboard
ClipWait ; wait untli the clipboard has something
ifInString, clipboard, whateveryouwanttofind ; used to search webpage source that is now in the clipboard
{
Winclose, Title[1] - Notepad ; close notepad which showed page source
WinActivate, whateverwebpage ; activate web page
ControlSetText, Edit1, javascript:(event), whateverwebpage ; send javascript commands to url/address bar
}
|
Note- I can put the above into a "loop" and then use the "break" command if something I want is found in the page source (using ifInString) that was copied to the clipboard.
The reason why I would do this would be to get a positive ID that the webpage has loaded, to "read" the web page and make sure that what I want is on that web page. I would then proceed to enter javascript commands, go to other links based on what the web page contained, etc...
Automating Web pages is difficult, but it is also something I think many users would like to do with AutoHotkey.
Any additional features in AutoHotkey that could help this situation would be really nice. |
|
| Back to top |
|
 |
AHKnow* Guest
|
Posted: Tue Oct 18, 2005 3:02 pm Post subject: |
|
|
| Code: |
SetTitleMatchMode, 1
SetTitleMatchMode, Slow
Loop, 10 ; This is acting as a kind of time out... up to you if you want it...
{
Sleep, 10000 ; just slow it down a bit and checks "casually".
WinActivate, whateverwebpage
ControlFocus, whatevercontrolau3spyfinds, whateverwebpage ; focus on area you want to copy
Sleep, 1000
Send, ^a ; select all
Sleep, 1000
Send, ^c ; copy all
ClipWait
ifInString, clipboard, whateveryouwanttofind ; Use to "ID"/"Verify" something you are waiting for
{
WinActivate, whateverwebpage
ControlSetText, Edit1, javascript:(event), whateverwebpage
ControlSend, Edit1, {Enter}, whateverwebpage
Break ; when you have found what you want break loop and do something
}
|
This is another example and without right-clicking to get page source. You basically stay in a loop until whatever you want on the page shows up, gets copied to the clipboard, then you can use the clipboard info. to verify that the page or info. you want has loaded, and then you can proceed to something else.
You don't have to use javascript command, though I find them handy, and you can just use controlsend or regular send (but I like controlsend better). |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|