Skip to content

Instantly share code, notes, and snippets.

@vmsp
Created March 19, 2023 12:28
Show Gist options
  • Save vmsp/70f4df0668d98abf389c4e886a6848d1 to your computer and use it in GitHub Desktop.
Save vmsp/70f4df0668d98abf389c4e886a6848d1 to your computer and use it in GitHub Desktop.
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