Automator: Open the current PDF file in Preview with another app
After I open a PDF file with Preview, I want to open the same file in another PDF viewer (Skim or Adobe Acrobat). How can Automator do this?
Here is an Automator Service/Quick Action that will open in Skim the front opened PDF document in Preview from the Preview > Services menu, or a keyboard shortcut if assigned in System Preferences > Keyboard > Shortcuts > Services.
This Automator Service was tested and works for me under macOS High Sierra assigning it a keyboard shortcut of ⌥⌘S, but should work as a Quick Action in macOS Mojave and later.
Example AppleScript code:
on run {input, parameters}
tell application "Preview" to ¬
set pdfDoc to (path of front document)
tell application "Skim" to open pdfDoc
end run
Here is an Automator Service/Quick Action that will open the same PDF document(s) in both Preview and Skim from Finder.
In Finder, select one or more PDF documents, or a folder full of PDF documents and then right-click and select, e.g., Open PDF in Preview and Skim from the Services context menu.
This Automator Service was tested and works for me under macOS High Sierra, but should work as a Quick Action in macOS Mojave and later.
Example AppleScript code:
on run {input, parameters}
tell application "Preview" to open input
tell application "Skim" to open input
end run
Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5
, with the value of the delay set appropriately.