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?
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!