Last active
December 23, 2015 12:39
-
-
Save manufaktor/6636597 to your computer and use it in GitHub Desktop.
Open with Apple Script editor, Export as "Application" with "Run only" flag and add to your dock. Happy PDF preview!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Setup: | |
-- 1. Open with Apple Script editor | |
-- 2. Export as "Application" with "Run only" flag | |
-- 3. Add to your dock. Happy PDF preview! | |
set webBrowser to "Firefox" -- or Safari | |
set pdfMenuItemTitle to "Open PDF in Preview" -- the title of the menu item you want | |
set myDelay to 0.2 | |
tell application webBrowser to activate | |
tell application "System Events" | |
tell process webBrowser | |
-- open the print dialog | |
click menu item "Print…" of menu 1 of menu bar item "File" of menu bar 1 | |
delay myDelay | |
-- open the pdf menu items | |
if webBrowser is "Firefox" then | |
click menu button "PDF" of window "Print" | |
else | |
click menu button "PDF" of sheet 1 of window 1 | |
end if | |
delay myDelay | |
-- click the preview as pdf menu item | |
if webBrowser is "Firefox" then | |
click menu item pdfMenuItemTitle of menu 1 of menu button "PDF" of window "Print" | |
else | |
click menu item pdfMenuItemTitle of menu 1 of menu button "PDF" of sheet 1 of window 1 | |
end if | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment