Skip to content

Instantly share code, notes, and snippets.

@eruffaldi
Last active May 30, 2017 05:40
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 eruffaldi/08fcd7349adc787ba40d89665d86afa5 to your computer and use it in GitHub Desktop.
Save eruffaldi/08fcd7349adc787ba40d89665d86afa5 to your computer and use it in GitHub Desktop.
Makefile for papers with figures generated
outputs = Generic.pdf Architecture.pdf Hybrid.pdf ConsoleArch.pdf
all: ${outputs}
tmp.pdf: Images.pptx
osascript pptexport.applescript $(abspath $<) $(abspath tmp.pdf)
${outputs}: tmp.pdf
# map slides to file and crop
pdftk tmp.pdf cat 5 output /tmp/tmpc.pdf && pdfcrop /tmp/tmpc.pdf Architecture.pdf
pdftk tmp.pdf cat 6 output /tmp/tmpc.pdf && pdfcrop /tmp/tmpc.pdf Generic.pdf
pdftk tmp.pdf cat 7 output /tmp/tmpc.pdf && pdfcrop /tmp/tmpc.pdf Hybrid.pdf
pdftk tmp.pdf cat 8 output /tmp/tmpc.pdf && pdfcrop /tmp/tmpc.pdf ConsoleArch.pdf
rm /tmp/tmpc.pdf
on run {inpath,outpath}
set outpathx to POSIX file outpath
set outpathy to outpathx as string
tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
log outpath
launch
set theDial to start up dialog
set start up dialog to false
open inpath
set outpathy to my createEmptyFile(outpathy)
save active presentation in outpathy as save as PDF -- save in same folder
close active presentation saving no
set start up dialog to theDial
end tell
end run
on createEmptyFile(f)
do shell script "touch " & quoted form of POSIX path of f -- create file (this command do nothing when the PDF file exists)
return (POSIX path of f) as POSIX file
end createEmptyFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment