Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Apple Keynote: export presenter notes
-- HOWTO:
-- after saving it, open with Script Editor (default) and run it
-- PREREQUISITES:
-- make sure your Keynote presentation is open in the background
-- AFTER EXPORT:
-- if you can't open the file due to encoding errors, open with Sublime (or another a text editor) and then "File / Save with encoding / UTF8"
tell application "Keynote"
activate
-- open (choose file)
tell front document
-- Get the name of the presentation.
set thePresentationName to name
-- Retrieve the titles of all slides.
set theTitles to object text of default title item of every slide
-- Retrieve the presenter notes for all slides.
set theNotes to presenter notes of every slide
end tell
end tell
set presenterNotes to ""
repeat with a from 1 to length of theTitles
-- skip slides with empty notes
if not (item a of theNotes) = "" then
set presenterNotes to presenterNotes & "#### Slide " & a & ": " & item a of theTitles & return & return
set presenterNotes to presenterNotes & "##### Presenter Notes: " & return & item a of theNotes & return & return
end if
end repeat
set the clipboard to presenterNotes
do shell script "pbpaste > ~/Desktop/keynote-notes-" & quoted form of thePresentationName & ".md"
-- based on http://apple.stackexchange.com/questions/136118/how-to-print-full-presenter-notes-without-slides-in-keynote
@paustian
Copy link

paustian commented Jun 4, 2018

Great code. I tested it on Keynote 8 on macOS High Sierra, v 10.13.4

@magalhini
Copy link

magalhini commented Jul 18, 2018

This is epic, thank you! The old script isn't working anymore. Do you have any idea how we could get the notes to be exported in utf-8, however? Special characters aren't being exported right...!

@ludzeller
Copy link

ludzeller commented Oct 10, 2018

Works for me, thank you!

Keynote 8.1
MacOS 10.13.3

But I also have issues with some characters such as single quotation marks (').

Is there a way to exclude skipped slides?

@chuycepeda
Copy link

chuycepeda commented Nov 7, 2018

@ludzeller, you end up with a clipboard element, so after export you can paste in a document and correct characters will come.

another option is to replace

do shell script "pbpaste > ~/Desktop/keynote-notes-" & thePresentationName & ".md"

with

do shell script "pbpaste > ~/Desktop/keynote-notes.txt"

@gt86
Copy link

gt86 commented Dec 4, 2018

Really helpful script, thanks.
Worked first time for me with Keynote 8.3 on macOS 10.14.1.
I changed the output file type from .md to .rtf just to make it easier for input to another application.

@vfongmala
Copy link

vfongmala commented Aug 9, 2019

How can I update the script to support other language from English?

Updated: I found out that text which copied to clipboard is already support UTF-8. I'll just need to config pbcopy to support UTF-8

@FMassin
Copy link

FMassin commented Jul 2, 2020

After executing this (without success), I cannot print anything in any app, even after restarting the computer.

@johnwry
Copy link

johnwry commented Dec 14, 2020

could anyone direct me to how to export the notes to html with the slides?

@nspassov
Copy link

nspassov commented May 22, 2021

Fantastic, works with Keynote 11 on Catalina. Thanks!

@jessamynwest
Copy link

jessamynwest commented Jun 4, 2021

Used it today with Keynote 10 and Mojave. Thank you.

@johnwry
Copy link

johnwry commented Jun 4, 2021

This works great! Is there anyway to include images in MD file? For instance, image1

@michaelzed
Copy link

michaelzed commented Feb 3, 2022

Works on Monterey, but saved file name had no file extension. I manually added .txt and it was fine.

@frankrausch
Copy link

frankrausch commented Mar 6, 2022

To support UTF-8 encoding (which prevents “broken” special characters), change the last line to

do shell script "LANG=en_US.UTF-8 pbpaste > ~/Desktop/keynote-notes-" & thePresentationName & ".md"

@RunsOnCoffee
Copy link

RunsOnCoffee commented May 2, 2022

Great script. The last line which exports to a Markdown file should be changed, though... as written, if the presentation name has spaces, the script will terminate the name after the first word and not include the extension. @michaelzed notes this issue above. Changing the line to read as below will fix the problem:

do shell script "pbpaste > ~/Desktop/keynote-notes-" & quoted form of thePresentationName & ".md"

@lambdamusic
Copy link
Author

lambdamusic commented May 12, 2022

Thanks @frankrausch @RunsOnCoffee, last line updated

@efc
Copy link

efc commented Jun 5, 2022

Thanks for this script. It worked perfectly for me.

@lmerk567
Copy link

lmerk567 commented Jun 28, 2022

Worked so great; thanks very much!

(I couldn't figure out how to do that "save with encoding" process provided in the comments, so just created a blank new script in the Script Editor, and copied/pasted the code into that.)

@TravelingTartar
Copy link

TravelingTartar commented Jul 29, 2022

Does anyone get an error: "Keynote got an error: Can't get document 1."?
The Result I get is: error "Keynote got an error: Can’t get document 1." number -1728 from document 1"
edit
Never mind, figured it out. BITDEFENDER was blocking the document. Now works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment