Last active
April 28, 2024 11:13
-
-
Save fanaugen/1789927 to your computer and use it in GitHub Desktop.
Automator workflow to batch-convert MS Word documents (.doc, .docx) into PDF using Apple Pages
This file contains hidden or 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
(* | |
* embed this applescript into an Automator workflow to batch-convert | |
* MS Word documents (.doc, .docx) into PDF using Apple Pages. | |
*) | |
on run {input, parameters} | |
tell application "Pages" | |
activate | |
repeat with doc in input | |
tell application "Finder" | |
set fname to name of (info for doc) | |
set thePath to (container of doc) as alias as text | |
set newFile to (thePath & fname & ".pdf") | |
end tell | |
try | |
open doc | |
set thisDoc to front document | |
save thisDoc as "SLDocumentTypePDF" in newFile | |
close thisDoc saving no | |
on error | |
display dialog "Some problem occurred. | |
File " & fname & " | |
could not be saved as PDF." | |
end try | |
end repeat | |
end tell | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, this is a great workflow. I've been trying to adapt it to convert .doc to .pages but couldn't get it to do that (I get the error message every time). What do I have to put instead of "SLDocumentTypePDF" if I want to convert to .pages? Thanks for your help!