Sync Taskpaper to a Mail.app draft

Posted March 19, 2008 by Arnaud in imap taskpaper

Hi,

I just wrote two little applescripts to sync my (only) taskpaper document to a mail.app IMAP draft.. it allows me to share the doc on two computers, and to edit it via Mail on my iPhone!

The scripts are very simple and I'm pretty sure it's easy to find a bug.. they can't do any merge or this kind of thing, but they can be interesting templates for something more complicated:

Mail to TaskPaper.scpt:

tell application "Mail"
    check for new mail for first account
    set newtasks to content of first message of mailbox "Drafts" of first account where subject is "Todolist TaskPaper"
end tell

tell application "TaskPaper"
    set text contents of front document to newtasks
end tell

TaskPaper to Mail.scpt:

tell application "TaskPaper"
    set tasks to text contents of front document
end tell

tell application "Mail"
    check for new mail for first account
    try
        set olddr to first message of mailbox "Drafts" of first account where subject is "Todolist TaskPaper"

        # delete doesn't work
        move olddr to mailbox "Trash" of first account
    end try

    set newdr to make new outgoing message with properties {visible:false, subject:"Todolist TaskPaper"}
    tell newdr to set content to tasks
    save newdr
    close newdr
end tell

Hope this helps!

jesse - March 19, 2008 11:57 AM

Thanks for sharing.

ClintMacD - March 19, 2008 12:04 PM

I just wrote two little applescripts to sync my (only) taskpaper document to a mail.app IMAP draft.

This looks marvelous — thanks!

Could you give us an example of how you use the pair of scripts? For example, can you have them run periodically (somehow), or must you choose them from the Scripts menu?

Thanks!

Best wishes, Clint

Arnaud - March 19, 2008 2:29 PM

Actually I use the script from the "scripts" menu of Taskpaper... But i'm pretty sure it's possible to run it periodically from cron or something like that

Misha - March 20, 2008 4:37 PM

This should be built in!

I'm sure Mail is the client of choice for most people, and syncing your tasks to Mail would be very handy. IMAP can sync them with the server for you, so it's super-simple to check (and edit!) your tasks on the go. Say, from an iPhone.

It's not as fancy as an iPhone app, but a fairly elegant solution nonetheless.

pascalv - March 26, 2008 8:15 AM

hi,

just installed update for final release of MailTag which claims about its Extras:

We plan to publish an Extras SDK so others can extend MailTags

knowing what MailTags add to Mail, this could be a stepping stone to sync with TP in the future.

I'm sure Jesse will keep an eye on it once vs 2.0 is out of the way...

Topic's comments