-
-
Save boillodmanuel/1f4b94f0410081338a98935f13c557da to your computer and use it in GitHub Desktop.
| global presenterNotes | |
| tell application "Keynote" | |
| activate | |
| open (choose file) | |
| tell front document | |
| do shell script "rm -f ~/keynote-notes.txt" | |
| set num to 0 | |
| repeat with aSlide in every slide | |
| set num to num + 1 | |
| do shell script "echo '-- " & num & " --' >> ~/keynote-notes.txt" | |
| set slideNote to presenter notes of aSlide as text | |
| do shell script "echo '" & slideNote & "' >> ~/keynote-notes.txt" | |
| do shell script "echo '' >> ~/keynote-notes.txt" | |
| end repeat | |
| end tell | |
| quit application "Keynote" | |
| end tell |
Hmmm, I was able to successfully run the script on stackexchange and it dumped the notes onto the clipboard. I just copied it into ScriptEditor and hit the "run" triangle button. But the script here gives errors when I try to run it the same way, ScriptEditor result is:
error "Keynote got an error: sh: line 4: Advisory: command not found
sh: line 6: Always: command not found
sh: line 8: Explain: command not found
sh: line 9: Current: command not found
sh: line 11: Apology: command not found
sh: line 12: The: command not found
sh: line 13: We: command not found
sh: line 14: This: command not found
sh: -c: line 15: unexpected EOF while looking for matching `''
sh: -c: line 16: syntax error: unexpected end of file" number 2
Maybe the tbrk comment is the solution - but I don't know how to make the change? Thanks!
This will break if the speaker notes contain any single-quote characters ('). Here's a more robust version, tested with Keynote 14.4 (September 2025). It also creates a unique new file on each run, in case you want to review older / newer version of your notes:
tell application "Keynote"
activate
open (choose file)
tell front document
set timestamp to do shell script "date '+%Y%m%d-%H%M%S'"
set outputFile to "~/keynote-notes-" & timestamp & ".txt"
set num to 0
repeat with aSlide in every slide
set num to num + 1
do shell script "echo '-- " & num & " --' >> " & outputFile
set slideNote to presenter notes of aSlide as text
set quotedNote to quoted form of slideNote
do shell script "echo " & quotedNote & " >> " & outputFile
do shell script "echo '' >> " & outputFile
end repeat
do shell script "echo 'Notes saved to: " & outputFile & "'"
end tell
quit application "Keynote"
end tell
Thanks for posting your version of this script. I would just note that the global variable should probably be
slideNoteand also that thepbpastein the original script is better because it has no problems with single quotes in the presenter notes.