Save as web archive if text found
Save as web archive if text found
- Subject: Save as web archive if text found
- From: Bryan Harris <email@hidden>
- Date: Wed, 13 Nov 2013 00:21:13 +0000 (GMT)
Hi all,
After some google searches I think this may not be possible. However, I thought I'd ask if anyone knows how just in case. I have the following script which I found on the apple forums. It saves as web archive, and I run it from the Terminal in a loop so it runs over and over again for multiple URLs (I would perhaps like to save hundreds at a time).
Can I choose to save as web archive only if a search string is found within the web page?
on run argv
set theURL to item 1 of argv
tell application "Safari"
activate
set the URL of front document to theURL
tell application "System Events"
tell process "Safari"
tell menu 1 of menu bar item "File" of menu bar 1
repeat while enabled of menu item "Save as…" is false
delay 0.1
end repeat
end tell
keystroke "s" using command down -- Save As…
repeat until sheet 1 of window 1 exists
delay 0.1
end repeat
keystroke "d" using command down -- save to Desktop
tell sheet 1 of window 1
click pop up button 1 of group 1
keystroke "W" & return -- Web Archive
keystroke return -- Save
if sheet 1 exists then -- that is "sheet 1 of sheet 1"
click button "Replace" of sheet 1
end if
end tell
end tell
end tell
end tell
end run
_______________________________________________
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