|
|
Bulk convert Safari's Web Archives to PDFs
Here's a script that I use as the source for a Run AppleScript action that follows a Get Specified URLs action to print various webpages to PDF in Preview:
on run {input, parameters}
if my GUIScripting_status() is false then error number -128
repeat with i from 1 to the count of input
set this_URL to (item i of input) as string
tell application "Safari"
activate
make new document with properties {URL:this_URL}
delay 3
end tell
tell application "System Events"
tell process "Safari"
keystroke "p" using command down
repeat until (exists sheet 1 of window 1)
delay 1
end repeat
click menu button "PDF" of sheet 1 of window 1
delay 1
tell menu 1 of menu button "PDF" of sheet 1 of window 1
click menu item "Open PDF in Preview"
end tell
end tell
end tell
delay 2
tell application "Safari"
activate
close document 1 saving no
end tell
end repeat
return input
end run
on GUIScripting_status()
-- check to see if assistive devices is enabled
tell application "System Events"
set UI_enabled to UI elements enabled
end tell
if UI_enabled is false then
run script "tell application \"System Preferences\"
activate
set current pane to pane id \"com.apple.preference.universalaccess\"
display dialog \"This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS X which is currently disabled.\" & return & return & \"You can activate GUI Scripting by selecting the checkbox “Enable access for assistive devices” in the Universal Access preference pane.\" with icon 1 buttons {\"Cancel\"} default button 1
end tell"
return false
else
return true
end if
end GUIScripting_statusEdited on Feb 19, '10 10:39:52AM by robg
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.11 seconds |
|