Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save RichardDooling/5e616a40d2969ba136a4 to your computer and use it in GitHub Desktop.

Select an option

Save RichardDooling/5e616a40d2969ba136a4 to your computer and use it in GitHub Desktop.

Revisions

  1. RichardDooling revised this gist Nov 4, 2014. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions 2014_11_02_Send_Keynote_Text_To_Markdown_File.applescript
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    --==============================
    -- 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 <ben@automatedworkflows.com>
    @@ -51,13 +54,13 @@ 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 "<br>"
    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
    -- 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")
  2. RichardDooling renamed this gist Nov 4, 2014. 1 changed file with 0 additions and 0 deletions.
  3. RichardDooling revised this gist Nov 3, 2014. 1 changed file with 16 additions and 12 deletions.
    28 changes: 16 additions & 12 deletions 2014-04-03 Send Keynote Presenter Notes to Evernote.applescript
    Original file line number Diff line number Diff line change
    @@ -35,17 +35,18 @@ tell application "Keynote"
    end tell
    end tell

    -- Prepare the notes as HTML.
    set theFormattedNotes to "<html><body><h1>" & "Keynote Presentation: " & thePresentationName & "</h1>" & return
    -- 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 & "<h2>Slide #" & a & "</h2>" & return
    set theFormattedNotes to theFormattedNotes & "<b>Title: " & item a of theTitles & "</b>" & return & return
    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 & "<b>Body:</b> " & item a of theBodyText & return & return
    set theFormattedNotes to theFormattedNotes & "#### Body " & return & return & item a of theBodyText & return & return
    end if
    set theFormattedNotes to theFormattedNotes & "<b>Presenter Notes:</b> " & item a of theNotes & return & return
    set theFormattedNotes to theFormattedNotes & "#### Presenter Notes: " & return & return & item a of theNotes & return & return
    end repeat
    set theFormattedNotes to theFormattedNotes & "</body></html>"
    set theFormattedNotes to theFormattedNotes & return


    -- Replace any returns with line breaks.
    set AppleScript's text item delimiters to {return, ASCII character 10}
    @@ -54,9 +55,12 @@ set AppleScript's text item delimiters to "<br>"
    set theFormattedNotes to theFormattedNotes as string
    set AppleScript's text item delimiters to ""

    -- Create the note in Evernote.
    tell application "Evernote"
    tell application "TextEdit"
    activate
    set theNote to create note notebook "Inbox" title thePresentationName with html theFormattedNotes
    open note window with theNote
    end tell
    -- 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

  4. @benwaldie benwaldie created this gist Apr 3, 2014.
    62 changes: 62 additions & 0 deletions 2014-04-03 Send Keynote Presenter Notes to Evernote.applescript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    --==============================
    -- Send Keynote Presenter Notes to Evernote
    -- Version 1.0.1
    -- Written By: Ben Waldie <ben@automatedworkflows.com>
    -- 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 HTML.
    set theFormattedNotes to "<html><body><h1>" & "Keynote Presentation: " & thePresentationName & "</h1>" & return
    repeat with a from 1 to length of theTitles
    set theFormattedNotes to theFormattedNotes & "<h2>Slide #" & a & "</h2>" & return
    set theFormattedNotes to theFormattedNotes & "<b>Title: " & item a of theTitles & "</b>" & return & return
    if extractBody = true then
    set theFormattedNotes to theFormattedNotes & "<b>Body:</b> " & item a of theBodyText & return & return
    end if
    set theFormattedNotes to theFormattedNotes & "<b>Presenter Notes:</b> " & item a of theNotes & return & return
    end repeat
    set theFormattedNotes to theFormattedNotes & "</body></html>"

    -- 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 "<br>"
    set theFormattedNotes to theFormattedNotes as string
    set AppleScript's text item delimiters to ""

    -- Create the note in Evernote.
    tell application "Evernote"
    activate
    set theNote to create note notebook "Inbox" title thePresentationName with html theFormattedNotes
    open note window with theNote
    end tell