Created
March 19, 2023 12:28
-
-
Save vmsp/70f4df0668d98abf389c4e886a6848d1 to your computer and use it in GitHub Desktop.
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
on run {input, parameters} | |
tell application "Microsoft Word" | |
activate | |
repeat with i in input | |
open i | |
--click button "Enable Macros" of window 1 | |
set pdfFilename to my swapExt(i) | |
set doc to the active document | |
save as doc file format format PDF file name pdfFilename | |
close doc | |
end repeat | |
end tell | |
end run | |
on swapExt(f) | |
set t to f as string | |
if t ends with ".docx" then | |
return (text 1 thru -5 of t) & "pdf" | |
else | |
return t & ".pdf" | |
end if | |
end swapExt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment