Re: I need to allow a web page to fully load before saving it with my script
Re: I need to allow a web page to fully load before saving it with my script
- Subject: Re: I need to allow a web page to fully load before saving it with my script
- From: "email@hidden" <email@hidden>
- Date: Wed, 15 Sep 2010 07:04:00 -0700
On Sep 14, 2010, at 11:16pm, Jeff Porrello wrote: I need to allow a web page to fully load before saving it with my script.
Here's a solution from the archives that I've used. If you are downloading a PDF you can use the trick where you check the size of the pdf every few seconds, knowing that if the size hasn't changed in the last 10 seconds it's downloaded.
HTH
ES
On Aug 2, 2009, at 6:01am, Adam Morris wrote: Hi all,
I have a program that downloads the PDFs provided from a webpage from my university (for copying automatically to my Kindle). I've been using the delay command to make it wait for the download and has worked fine, but I've always wanted a script function that would loop until Safari's front page stopped loading. This is what I have been using:
on waitforload() tell application "Safari" delay 1 repeat set thisDoc to front document if (do _javascript_ "document.readyState" in thisDoc) is "complete" then exit repeat delay 2 -- wait a second before checking again end repeat delay 1 end tell end waitforload
This only works for the loading of the HTML/CSS/DOM side, but doesn't reflect the fact that, in some cases (including mine) the document.readyState shows "complete" even though the document itself actually downloading a PDF.
|
_______________________________________________
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