Last active
March 9, 2018 05:18
-
-
Save rjyo/6184e027caee32358385438ff876181c to your computer and use it in GitHub Desktop.
Select a keynote and export to PDF using the "Better" quality
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 last_offset(the_text, char) | |
try | |
set i to 1 | |
set last_occurrence to 0 | |
repeat count of the_text times | |
if item i of the_text as string = char then | |
set last_occurrence to i | |
end if | |
set i to i + 1 | |
end repeat | |
on error | |
return 0 | |
end try | |
return last_occurrence | |
end last_offset | |
set in_file to choose file with prompt "Select Keynote file to continue:" of type {"key", "pages"} | |
set in_file to (in_file as Unicode text) | |
set pos to (my last_offset(in_file, ".")) - 1 | |
set out_file to text 1 thru pos of in_file & ".pdf" | |
set ext to text ((offset of "." in in_file) + 1) thru -1 of in_file | |
if ext = "key" then | |
tell application "Keynote" | |
set my_doc to open file (in_file as Unicode text) -- open input file in Pages | |
-- do the exporting (Good, Better, Best) | |
export my_doc to file (out_file as Unicode text) as PDF with properties {PDF image quality:Better} | |
close my_doc saving no -- close the original file without saving | |
end tell | |
else | |
tell application "Pages" | |
set my_doc to open file (in_file as Unicode text) -- open input file in Pages | |
-- do the exporting (Good, Better, Best) | |
export my_doc to file (out_file as Unicode text) as PDF with properties {image quality:Better} | |
close my_doc saving no -- close the original file without saving | |
end tell | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment