Re: How do I pause a script to allow a webpage to load and then resume the script?
Re: How do I pause a script to allow a webpage to load and then resume the script?
- Subject: Re: How do I pause a script to allow a webpage to load and then resume the script?
- From: Emmanuel LEVY <email@hidden>
- Date: Mon, 14 Dec 2009 00:31:25 +0100
We Quomodo are glad to share a piece of our scripts if it can help:
on runinsafari(x)
set AppName to "Safari" -- please don't launch Safari every time I
compile
tell application AppName to set res to «event sfridojs» x given
«class dcnm»:document 1
try
return res
on error
return ""
end try
end runinsafari
on waituntilcomplete()
repeat
delay 0.3 -- untested, was smilepause 0.3
if runinsafari("document.readyState") is "complete" then exit repeat
end repeat
delay 1 -- untested, was smilepause 1
end waituntilcomplete
Emmanuel
On Dec 13, 2009, at 10:12 PM, Jeffrey L.Porrello wrote:
Note: Safari is already active with no open windows.
The script:
activate application "Safari"
set artnum to 0
repeat 1000 times
open location "http://theknowledgebaseiamaccessing.com/articlenumber=
" & artnum
delay 10
get name of 1st window of application "Safari"
if result is ... then
...
...
...
...
...
...
...
...
...
...
...
end if
set artnum to artnum + 1
end repeat
It is the 5th line (the delay line) I would like to modify. I would
like it to say in essence: "wait until the page has finished loading"
DOES ANYONE KNOW HOW TO DO THIS???
You get the idea. Instead of using a fixed delay of "x" number of
seconds, I would prefer a way to pause just long enough for the page
to finish loading before moving on with the script. This would
prevent the problems that crop up when a page hasn't fully loaded
before being passed on to the filtering stage of the script. It
would also speed things along since most pages load in less, rather
than more time.
Any help would be greatly appreciated
Jeff P.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden