• 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: Emmanuel LEVY <email@hidden>
  • Date: Wed, 15 Sep 2010 08:29:41 +0200

You can use Satimage's readtext command to download a page, and it's synchronous, unlike open location:

set s to readtext "http://docs.info.apple.com/article.html?artnum="; & artnum
writetext s to [ new file path here ]


Emmanuel

On Sep 15, 2010, at 8:16 AM, Jeff Porrello wrote:

I need to allow a web page to fully load before saving it with my script.

I have written a script which automatically downloads Knowledge Base documents from Apple's Support web site (I am a technical information hound). I use the "Open Location" command to open a particular web page. I need the page to fully load before issuing the "Save As..." command. Does anyone know how to write this portion of a script?

Any help would be GREATLY appreciated!

Thank You!

activate application "Safari"
set artnum to 3
repeat 78000 times
open location "http://docs.info.apple.com/article.html?artnum="; & artnum
I WOULD LIKE TO INSERT THE NEEDED PIECE OF SCRIPT HERE
get name of 1st window of application "Safari"
if result is "AppleCare" then
close 1st window of application "Safari"
else if result is "We're sorry. (404)" then
close 1st window of application "Safari"
else if result is "Apple - Login" then
close 1st window of application "Safari"
else if result is "403 Forbidden" then
close 1st window of application "Safari"
else if result is "Apple - Support - Downloads" then
close 1st window of application "Safari"
else
get name of 1st window of application "Safari"
if result is "AppleCare Knowledge Base" then
tell application "System Events"
tell process "Safari"
key down command
keystroke "r"
key up command
AND HERE
end tell
end tell
end if
tell application "System Events"
tell process "Safari"
key down command
key down shift
keystroke "s"
key up shift
key up command
delay 2
keystroke return
end tell
end tell
delay 2
close 1st window of application "Safari"
end if
set artnum to artnum + 1
end repeat



Thanks Again!
_______________________________________________
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
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: I need to allow a web page to fully load before saving it with my script
  • Next by Date: Re: set vs copy?
  • Previous by thread: I need to allow a web page to fully load before saving it with my script
  • Next by thread: Re: I need to allow a web page to fully load before saving it with my script
  • Index(es):
    • Date
    • Thread