Skip to content

Instantly share code, notes, and snippets.

@joe-pindell
Created April 8, 2011 20:18
Show Gist options
  • Save joe-pindell/910621 to your computer and use it in GitHub Desktop.
Save joe-pindell/910621 to your computer and use it in GitHub Desktop.
An Applescript to export from Things to TaskPaper
set thePath to (path to desktop as Unicode text) & "ThingsToDo.txt"
set thingsToDoFile to (open for access file thePath with write permission)
set eof of thingsToDoFile to 0
set cr to ASCII character 10
tell application "Things"
-- Export to-dos from Inbox
write "Inbox:" & return to thingsToDoFile as «class utf8»
repeat with td in to dos of list "Inbox"
set tdName to the name of td
set tdNotes to the notes of td
write tab & "- " & tdName & return to thingsToDoFile as «class utf8»
if tdNotes is not "" then
set fixedNote to my replaceText(cr, "; ", tdNotes)
write tab & tab & fixedNote & return to thingsToDoFile as «class utf8»
end if
end repeat
write return to thingsToDoFile as «class utf8»
-- Walk through projects, export as project with their to-dos
repeat with pr in to dos of list "Projects"
set prName to the name of pr
set prNotes to the notes of pr
write prName & ":" & return to thingsToDoFile as «class utf8»
if prNotes is not "" then
set fixedNote to my replaceText(cr, "; ", prNotes)
write tab & fixedNote & return to thingsToDoFile as «class utf8»
end if
repeat with td in to dos of project prName
set tdName to the name of td
set tdNotes to the notes of td
write tab & "- " & tdName & return to thingsToDoFile as «class utf8»
if tdNotes is not "" then
set fixedNote to my replaceText(cr, "; ", tdNotes)
write tab & tab & fixedNote & return to thingsToDoFile as «class utf8»
end if
end repeat
write return to thingsToDoFile as «class utf8»
end repeat
-- Export to-dos from Someday
write "Someday:" & return to thingsToDoFile as «class utf8»
repeat with td in to dos of list "Someday"
set tdName to the name of td
set tdNotes to the notes of td
write tab & "- " & tdName & return to thingsToDoFile as «class utf8»
if tdNotes is not "" then
set fixedNote to my replaceText(cr, "; ", tdNotes)
write tab & tab & fixedNote & return to thingsToDoFile as «class utf8»
end if
end repeat
write return to thingsToDoFile as «class utf8»
close access thingsToDoFile
end tell
on replaceText(find, replace, someText)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set someText to text items of someText
set text item delimiters of AppleScript to replace
set someText to "" & someText
set text item delimiters of AppleScript to prevTIDs
return someText
end replaceText
@sfarestam
Copy link

Nice script! One thing is missing though; importing tasks from the "Today" list. I added it simply by copying the first block:

    write "Today:" & return to thingsToDoFile as «class utf8»
    repeat with td in to dos of list "Today"
        set tdName to the name of td
        set tdNotes to the notes of td
        write tab & "- " & tdName & return to thingsToDoFile as «class utf8»
        if tdNotes is not "" then
            set fixedNote to my replaceText(cr, "; ", tdNotes)
            write tab & tab & fixedNote & return to thingsToDoFile as «class utf8»
        end if
    end repeat
    write return to thingsToDoFile as «class utf8»

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