-
-
Save RichardDooling/5e616a40d2969ba136a4 to your computer and use it in GitHub Desktop.
--============================== | |
-- Send Keynote Text to Desktop Markdown File | |
-- Writted By: Richard Dooling https://github.com/RichardDooling/ | |
-- Based on | |
-- Send Keynote Presenter Notes to Evernote | |
-- Version 1.0.1 | |
-- Written By: Ben Waldie <[email protected]> | |
-- http://www.automatedworkflows.com | |
-- Version 1.0.0 - Initial release | |
-- Version 1.0.1 - Updated for Keynote 6.2 compatibility | |
--============================== | |
-- Make sure a presentation is opened in Keynote. If not, notify the user and stop. | |
tell application "Keynote" | |
if (front document exists) = false then | |
display alert "Unable to proceed." message "Please open a presentation in Keynote." | |
return | |
end if | |
set extractBody to button returned of (display alert "Would you like to extract slide content too?" buttons {"Yes", "No"}) = "Yes" | |
-- Target the front presentation. | |
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 | |
-- If specified, retrieve the body text of all slides | |
if extractBody = true then | |
set theBodyText to object text of default body item of every slide | |
end if | |
-- Retrieve the presenter notes for all slides. | |
set theNotes to presenter notes of every slide | |
end tell | |
end tell | |
-- Prepare the notes as Markdown. | |
set theFormattedNotes to "# " & "Keynote Presentation: " & thePresentationName & return & return | |
repeat with a from 1 to length of theTitles | |
set theFormattedNotes to theFormattedNotes & "## Slide " & a & return & return | |
set theFormattedNotes to theFormattedNotes & "### Title: " & item a of theTitles & return & return | |
if extractBody = true then | |
set theFormattedNotes to theFormattedNotes & "#### Body " & return & return & item a of theBodyText & return & return | |
end if | |
set theFormattedNotes to theFormattedNotes & "#### Presenter Notes: " & return & return & item a of theNotes & return & return | |
end repeat | |
set theFormattedNotes to theFormattedNotes & return | |
-- Replace any returns with line breaks. | |
set AppleScript's text item delimiters to {return, ASCII character 10} | |
set theFormattedNotes to text items of theFormattedNotes | |
set AppleScript's text item delimiters to {return, ASCII character 10} | |
set theFormattedNotes to theFormattedNotes as string | |
set AppleScript's text item delimiters to "" | |
tell application "TextEdit" | |
activate | |
-- Create Desktop Markdown .md file named after Presentation | |
set theDesktopPath to the path to the desktop folder as text | |
make new document with properties {text:theFormattedNotes} | |
save document 1 in file (theDesktopPath & thePresentationName & ".md") | |
close document 1 | |
end tell | |
I'm a major rookie...I tried to run this however, I am getting a permissions error. I'm assuming that this is referring to the file I'm trying to convert, not something within the script file. Is that correct?
I am on the lookout to find a way to extract the images together with the text from my Keynote presentations in some kind of format that I can then turn into HTML. In the end I want to arrive at the kind of layout achieved here:
You can tweak the PDF output from Keynote to look like this:
This gives me a PDF and it's the easiest way to share the content. But I would like to easily make websites from my presentations without endlessly going back and forth copy-pasting.
Anybody with any ideas?
Brilliant. Saved me a lot of cut and pasting. Thank you!!
Thank you, great script!
Thank you!
This looks great and just what I need.
But I have no idea how to use it, or even where to put it. ;-)
Can someone advise?
Thanks!
Aha! Good ol' AppleScript.
File runs but doesn't save; appears to stop at
save document 1 in file (theDesktopPath & thePresentationName & ".md")
Any suggestions?
thanks for the script. FYI this still works with Keynote 12.2.1 but does ask for permission to access Desktop, in line with security changes.
Thanks for your work! Is there a chance we will see an update for this to work with Keynote 6.6.1?
cheers, Bernd