Imap


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!

» 5 comments

Imap