• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I need to allow a web page to fully load before saving it with my script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >I need to allow a web page to fully load before saving it with my script (From: Jeff Porrello <email@hidden>)

  • Prev by Date: Re: Illustrator CS4 hierarchical menus
  • Next by Date: Re: Illustrator CS4 hierarchical menus
  • Previous by thread: Re: I need to allow a web page to fully load before saving it with my script
  • Next by thread: Click the app icon in Doc using applescript
  • Index(es):
    • Date
    • Thread