Skip to content

Instantly share code, notes, and snippets.

@bjesuiter
Last active March 26, 2024 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjesuiter/d9c36f44481dfda6859c09add2217905 to your computer and use it in GitHub Desktop.
Save bjesuiter/d9c36f44481dfda6859c09add2217905 to your computer and use it in GitHub Desktop.
AppleScript Snippets
# Credits for this script to ALYB at https://forum.keyboardmaestro.com/t/applescript-save-microsoft-word-doc-x-document-to-pdf/20614
tell application "Finder"
set input to selection
end tell
tell application id "com.microsoft.Word"
activate
set view type of view of active window to draft view
repeat with aFile in input
open aFile
set theOutputPath to ((aFile as text) & ".docx")
repeat while not (active document is not missing value)
delay 0.5
end repeat
set activeDoc to active document
save as activeDoc file name theOutputPath file format format document
close active document saving no
end repeat
end tell
# Credits for this script to ALYB at https://forum.keyboardmaestro.com/t/applescript-save-microsoft-word-doc-x-document-to-pdf/20614
tell application "Finder"
set input to selection
end tell
tell application id "com.microsoft.Word"
activate
set view type of view of active window to draft view
repeat with aFile in input
open aFile
set theOutputPath to ((aFile as text) & ".pdf")
repeat while not (active document is not missing value)
delay 0.5
end repeat
set activeDoc to active document
save as activeDoc file name theOutputPath file format format PDF
close active document saving no
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment