The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
OmniFocus<->Mail sync script ALPHA CODE FOR TESTING ONLY Thread Tools Search this Thread Display Modes
Note: I haven't tested this on the final Leopard release, only on the final seed. There's been a report of problems under leopard. I'll leave it here, but recommend not running it under leopard final at this time.

I wrote this up a while ago so that I could sync my tasks into mail messages, organized on a one folder per context basis (context mail folders nested like contexts in your OmniFocus document). This was done so that I could access them on my iPhone on the go, without having to leave my laptop running with the OmniFocus web interface. Additionally this allows easy creation of new tasks from any context in mail from the iPhone.

I've been using it without any bad behavior for a while, so thought I'd post it here, but given that Leopard will make this irrelevant very soon (I hope... I have no inside info there, sorry) I'm mostly posting this for use as an example of OmniFocus Applescripting. It's more or less well documented in the script and I'd recommend just reviewing it for juicy tidbits.

WARNING: This works for me but it might not work for you. It might destroy data, it might chew on your IMAP account till it looks like an old POP3. Who knows. THERE IS NO SUPPORT FOR THIS. Please don't email support about this script if you use it. They will come down and pelt me with your email, printed out onto heavy weight paper. It hurts when they do that. If you want to trial this, I'd recommend setting up a test mail account on a server and pointing the script at that (done by changing a setting at the top of the script).

The file is too big as a forum attachment, so here's a URL:

http://ethanschoonover.com/files/tem...-mail-sync.zip

AGAIN: While this works, it's going to be pointless soon and I'd suggest just taking a look at the script for examples of how to do the things it does in OmniFocus (or mail for that matter). For the sake of completeness, however, here are installation and use instructions if you are crazy enough to try it.

Installation:
You can either run the script from script editor or just drop it into ~/Library/Scripts/Applications/OmniFocus/ and then add it to the OmniFocus toolbar or run it from the Scripts menu.

Use
Just running the script without any modification should location your "default" IMAP or .Mac account in Mail.app (the account can be specified in the script), create nested folders under a "master" @Context folder in that account, populate those folders with tasks from each context.

IF YOU HAVE A LOT OF TASKS (>150) IN YOUR CONTEXTS, THE INITIAL EMAIL SENDOUT WILL TAKE A LONG TIME. It's email. It's slow. It's not a good transport mechanism for tasks. Sigh.

I just run it once before I go to bed and once before I leave the office.

Complete tasks by moving them to your "!Done" folder (also created by the script). This can be done the iPhone.

Make new tasks in mail by replying to the "New Task" mails in each context folder (replying to an existing task should create a new task with both the context and project of the 'original' task). These are filed into the "!New" mail folder which you can ignore.

Tiger/Leopard
This was coded on Tiger but I'm using it on Leopard and it seems ok. The only weirdness I've seen is that the mail messages aren't created in hidden mode on Leopard. There are also some weird random occasional slowdowns checking mailboxes.

Growl Abuse
I have growl turned on for status messages. LOTS of stats messages. Lame, maybe. You can turn this off at the top of the script.

WARNING
It's slow. Usually it's been okay to force quit the script/app if it really hangs. It should recover gracefully on next run.

Functions
* Identify key accounts and values in Mail.app
* Locate or make top level context, done, and new folders in Mail.app
* Locate or make context rules+folders in Mail.app as necessary
* (UNIMPLEMENTED) Make non folder rules (check for replies, flag messages, etc.)
* Check "Done" folder, get IDs of all done tasks, mark them complete
* (UNIMPLEMENTED) Check New mailbox, get reply mails and process them into new tasks
* Make list of IDs of current available tasks, then cycle through all message tasks and remove those that are ghosts. during this, possibly compile list of remaining taskid-mod dates-mailmsgid+mailbox
* Empty mailboxes as necessary (currently just from the "Done" mailbox)
* (UNIMPLEMENTED) Send out "Make New" messages
* Send out all new tasks (skipping those that we've established are already in Mail,
either in the context folders or outbox)
-----------------------------------------------------------------------------------
NOTES
Uses Growl if it can, should fall back to dialogues if it can't.
Minimizes network traffic by doing as little emailing as possible. because sending email is slow, and i don't like slow.
Does not remove context folders in Mail that the user stops using, deletes, renames, in OmniFocus.

Last edited by Ethan Schoonover; 2007-10-28 at 10:06 AM..
 
This looks very cool. Can't wait to try it.

BZ
 
Hopefully leopard is out soon and we can discard scripts like this. I've got a couple less crazy that I'll post later.
 
It hasn't been confirm though that the iPhone will sync tasks has it? I know Notes has been semi-CONFIRMED, but nothing about tasks. They need their own application.

BZ
 
I'm getting an "Error 8 NSInternalScriptError" message. Before the error, I get three growl notifications:

* Mail Sync In Progress: Seeting [sic] accounts & root mailboxes
* Mail Sync In Progress: Checking for top level context ,done, new folders
* Creating Mailbox: INBOX/@Contexts

Subsequent executions trigger the same error following the same growl notifications, so I suspect it's having problems creating the IMAP mailboxes.
 
I'm just thinking out loud here, not suggesting that Ethan scrap his clever IMAP sync script. But I wonder if syncing to Backpack would make sense. They have a well-documented API, and the app itself offers functionality beyond the scope of OmniFocus that's useful for capture, reference, and GTD in general. At a glance, the API interface seems like it would be a lot less chatty than IMAP, and adding/completing tasks would be more straightforward.

Of course, that leaves us back where we started: slow (at least with EDGE) online-only lists. But it's hosted.
 
Actually, this script is not going to see much more development if any. I have absolutely no insight into Apple's Leopard and iPhone plans, but the lack of notes/todo iPhone sync seems like a logical thing to address given the updates to those features in Leopard (publicly announced already).

Backpack sync is certainly possible. Again, though, for an iPhone access solution, let's hold our collective breath a couple more weeks. And cross out fingers. And click our heels together three times.
 
Quote:
Originally Posted by dansays View Post
I'm getting an "Error 8 NSInternalScriptError" message. Before the error, I get three growl notifications:

* Mail Sync In Progress: Seeting [sic] accounts & root mailboxes
* Mail Sync In Progress: Checking for top level context ,done, new folders
* Creating Mailbox: INBOX/@Contexts

Subsequent executions trigger the same error following the same growl notifications, so I suspect it's having problems creating the IMAP mailboxes.
I'm assuming this is something related to your IMAP server or the vagaries of Mail.app's applescript. Mail.app is not a joy to applescript, and I've already found a couple instances where this script can't create folders on certain servers.

If you have a .Mac account, I've tested against that. Otherwise... sorry it's not working on that account!
 
Hi. I have tried to implement your script, and this is the result: It creates the folders, and it sends the mail. But the new folders are all empty, ant the inbox full. Am I suppose to move the new mails into the new folders by myself or is the script suppose to do so?

Last edited by etvedt; 2007-10-17 at 05:15 AM..
 
Sounds like it's either not making the mail rules or the rules are inactive. You should check the rules in mail.app preferences and see if they are active and working.

If you're seeing this kind of error, though, I'd advice against using... just use the script for raw script material, so to speak.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Welcome to testing OmniFocus 2! Lizard OmniFocus 2 for Mac (Private Test) 1 2013-07-08 01:53 PM
Now accepting testing volunteers for the OmniFocus Mail Drop feature Brian Syncing via Omni Sync Server 32 2013-05-10 05:14 AM
Unable to sync using WebDAV-error code (403) 4louie Other WebDAV 2 2010-01-25 03:06 PM
OmniFocus Alpha vs Various GTD Apps ueila OmniFocus 1 for Mac 41 2008-08-27 05:26 AM
5/16 OmniFocus Alpha Notes BwanaZulia OmniFocus 1 for Mac 14 2007-05-20 08:39 PM


All times are GMT -8. The time now is 04:07 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.