TP2Keynote

Convert Taskpaper to Keynote

by Derick Fay, May 2013

Updated September 2013 to fix minor white space issues

This is a script I came up which will convert a Taskpaper document into a Keynote presentation. Obviously this is a non-standard use for Taskpaper, but it works well as an outliner to allow one to see the entire text of a slideshow and its presenter notes. Every project becomes a slide title, every task becomes a bullet point, and every note is added to the presenter notes.

tell application "TaskPaper"
set theProjects to projects of document 1

repeat with theProject in theProjects
    set theProjectName to name of theProject

    set theTasks to tasks of theProject
    set theBodyText to ""
    set n to 0
    repeat with theTask in theTasks
        set n to n + 1
        set theTaskText to (name of theTask as rich text)
        set theBodyText to theBodyText & theTaskText
        if n is not (count of theTasks) then
            set theBodyText to theBodyText & return
        end if

    end repeat

    set theNotes to notes of theProject
    set theNotesText to ""
    repeat with theNote in theNotes
        set theNoteText to name of theNote
        set theNotesText to theNotesText & return & theNoteText
    end repeat


    tell application "Keynote"
        activate
        tell slideshow 1
            set newSlide to make new slide
            if theProjectName is "" then
                set master of current slide to master slide "Bullets"
            end if
            tell current slide
                set title to theProjectName
                set body to theBodyText
                set notes to theNotesText
            end tell
        end tell
    end tell

end repeat

end tell