Created
June 17, 2023 22:30
-
-
Save mackenly/525e96379bce7d95d1effbdb3ed330cb to your computer and use it in GitHub Desktop.
Apple Script for converting a Keynote file to a folder of images. To use, create an Automator application and use an Apple Script block. Save the application to your desktop and you're good to go.
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 run {input, parameters} | |
-- Validate input | |
if input is {} then | |
display alert "No file selected!" message "Drop a file on the action to process the keynote." as warning | |
return | |
end if | |
-- Declare variables | |
set fileName to POSIX path of (input as string) | |
set fileName to do shell script "echo " & quoted form of fileName & " | tr ' ' '-'" | |
set currentDate to current date | |
set yearNumber to year of currentDate as string | |
set monthNumber to month of currentDate as integer as string | |
set dayNumber to day of currentDate as integer as string | |
set folderName to "" | |
-- build the folderName | |
set folderName to folderName & {"Keynote-Export_" & yearNumber & "-" & monthNumber & "-" & dayNumber} | |
-- Open keynote and export the file to images | |
tell application "Keynote" | |
set doc to open input as string | |
export doc to alias {"Macintosh HD:Users:yourusername:Desktop:" & folderName} as slide images with properties {image format:PNG} | |
quit | |
end tell | |
display notification with title "Keynote export done" subtitle "Completed" | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment