Skip to content

Instantly share code, notes, and snippets.

@cawka
Last active September 3, 2019 02:37
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 cawka/4cdd4cb6deeef95ad3f66e4536fe01e4 to your computer and use it in GitHub Desktop.
Save cawka/4cdd4cb6deeef95ad3f66e4536fe01e4 to your computer and use it in GitHub Desktop.
#!/usr/bin/osascript
on run argv
if not (count argv) = 2
return "Usage:\n pptx-to-pdf <input file> <output file>"
end if
set pwd to do shell script "pwd"
set _input to item 1 of argv as text
set _output to item 2 of argv as text
if not _input starts with "/"
set _input to pwd & "/" & _input
end if
if not _output starts with "/"
set _output to pwd & "/" & _output
end if
try
set _input to (get POSIX file _input as alias)
on error errStr number errorNumber
return "ERROR: File [" & _input & "] does not exists or cannot be opened"
end try
set _output to (get POSIX file _output as string)
tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
launch
open _input
save active presentation in _output as save as PDF
close active presentation
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment