Skip to content

Instantly share code, notes, and snippets.

@urschrei
Last active September 19, 2025 22:05
Show Gist options
  • Select an option

  • Save urschrei/4e9d8a8766660088bc7350efde8e3e35 to your computer and use it in GitHub Desktop.

Select an option

Save urschrei/4e9d8a8766660088bc7350efde8e3e35 to your computer and use it in GitHub Desktop.
Dump Keynote speaker notes to Markdown. Tested with Keynote 14.4 (September 2025)
-- Get file without activating Keynote
set chosenFile to choose file with prompt "Select a Keynote presentation:" of type {"key", "com.apple.iwork.keynote.key", "com.apple.iwork.keynote.sffkey"}
set fileName to name of (info for chosenFile)
-- Generate output filename
set timestamp to do shell script "date '+%Y%m%d-%H%M%S'"
set outputFile to "~/keynote-notes-" & timestamp & ".md"
set fullPath to do shell script "echo " & outputFile
tell application "Keynote"
-- Open without bringing to front
set wasRunning to running
open chosenFile
tell front document
set docTitle to name
set slideCount to count of slides
-- Write markdown header (using quoted form for safety)
do shell script "echo " & quoted form of ("# " & docTitle) & " > " & outputFile
do shell script "echo '' >> " & outputFile
do shell script "echo " & quoted form of ("**File:** `" & fileName & "` ") & " >> " & outputFile
do shell script "echo " & quoted form of ("**Slides:** " & slideCount & " ") & " >> " & outputFile
do shell script "echo '**Exported:** '$(date '+%Y-%m-%d at %H:%M:%S')' ' >> " & outputFile
do shell script "echo '' >> " & outputFile
do shell script "echo '---' >> " & outputFile
do shell script "echo '' >> " & outputFile
-- Export notes with progress
repeat with i from 1 to slideCount
-- Show progress in notification
if i mod 10 = 0 then
display notification "Processing slide " & i & " of " & slideCount with title "Exporting Keynote Notes"
end if
do shell script "echo " & quoted form of ("## Slide " & i) & " >> " & outputFile
do shell script "echo '' >> " & outputFile
set slideNote to presenter notes of slide i as text
if slideNote is not "" then
-- Handle multi-paragraph notes
set quotedNote to quoted form of slideNote
do shell script "echo " & quotedNote & " >> " & outputFile
else
do shell script "echo '*[No presenter notes]*' >> " & outputFile
end if
do shell script "echo '' >> " & outputFile
if i < slideCount then
do shell script "echo '---' >> " & outputFile
do shell script "echo '' >> " & outputFile
end if
end repeat
-- Add footer
do shell script "echo '' >> " & outputFile
do shell script "echo '---' >> " & outputFile
do shell script "echo '*End of presenter notes*' >> " & outputFile
close saving no
end tell
-- Only quit if Keynote wasn't running before
if not wasRunning then quit
end tell
-- Success notification and optional file opening
display notification "Notes exported to: " & fullPath with title "Export Complete" sound name "Glass"
display dialog "Keynote notes exported successfully!" & return & return & "File: " & fullPath buttons {"Open File", "Show in Finder", "Done"} default button "Done" with icon note
if button returned of result is "Open File" then
do shell script "open " & outputFile
else if button returned of result is "Show in Finder" then
do shell script "open -R " & outputFile
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment