Skip to content

Instantly share code, notes, and snippets.

@1024jp
Last active September 3, 2021 09:35
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 1024jp/1c13e597a22ce89ac26c7dd5bfcf46de to your computer and use it in GitHub Desktop.
Save 1024jp/1c13e597a22ce89ac26c7dd5bfcf46de to your computer and use it in GitHub Desktop.
Extract Presenter Notes
(*
Extract presenter notes of the front most Keynote document and save to Desktop as Markdown file.
Created by 1024jp on 2019-03-16.
© 2019 1024jp
*)
-- collect presenter notes
tell front document of application "Keynote"
set thePresentationTitle to name
set presenterNotes to "# " & name & return & return
repeat with i from 1 to count of slides
repeat 1 times -- # fake loop for loop continue
tell slide i
if presenter notes is "" then exit repeat
set theTitle to "## " & i & ". " & object text of default title item
set presenterNotes to presenterNotes & theTitle & return & return & presenter notes & return & return
end tell
end repeat
end repeat
end tell
-- create path to file
set theFileName to "presenterNotes-" & thePresentationTitle & ".md"
set theFilePath to (path to desktop folder as text) & theFileName
-- save to the file
try
set theFile to open for access theFilePath with write permission
on error
close access file theFilePath
return
end try
set eof of theFile to 0
write presenterNotes to theFile as «class utf8»
close access theFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment