We ❤ OmniFocus, but…

On our team a few of us use OmniFocus by @OmniGroup to keep organized. It’s a really great tool for managing to dos, assigning deadlines, defer dates, organizing projects and lists and … and … and …

But. It’s not great for sharing tasks between team members.

Still… I really like using it, so I thought: “Buy the Pro version, find a script for sharing tasks, send them off…”

Nope.

If you want to just get the script, and you don’t care about my feelings, just scroll to the bottom of the page.

Finding a Script

I found a bunch of scripts, but none of them really worked. The closest one I found was the Delegate and Defer script by Jered Benoit, though there were some behaviours I wanted to modify. I wanted to be able to select multiple tasks, and I didn’t want pop ups for every step of the way… The script should interpret empty variables like context, defer date and due date, create values for those fields if they don’t exist.

Since I couldn’t find one to do exactly what I wanted, I started groking.

AppleScript

Is it powerful? Yes. Is it friendly? NOPE! I figured it wouldn’t be too hard to hack together the functionality that I wanted, but after digging into a couple of the scripts I found, I soon realized that this endeavour was going to be a pain in the ass.

Documentation? Accurate but Useless

I found a lot of documentation on the lexicon of AppleScript. And, there’s a whole library for OmniFocus which implies that scripting is a powerful component of the application. However, the pure lack of examples to support any provided documentation is a major let down. Here’s an example of what I mean.

I want to create tasks, so I look in the Script Editor’s library, under OmniFocus for the definition of a task:

task n : A task. This might represent the root of a project, an action within a project or other action or an inbox item.
properties
id (text) : The identifier of the task.
name (text) : The name of the task.
note (rich text) : The note of the task.

Simple, I should be able to do something like:

set theNote to rich text of (note of the currentTask)

… but, no… I can’t use rich text variable even though it’s specified as…

note (rich text)

…and the program just doesn’t do anything when it runs because that’s how the script editor rolls…

So, I eventually…

set theNote to text of (note of the currentTask)

And, that’s fine.

A while later, I’m starting to work with contexts. And, I want to set the context of a new task to the name of the person to whom I am sending the task. So I look at the docs:

context n : A context.
properties
id (text) : The identifier of the context.
name (text) : The name of the context.

All I want is a simple context with a name, so I imagine I can do…

make task with properties {{name:my buildTaskName(waitingPrefix, delegatedTo, name of selectedTask), note:(note of the selectedTask) as string, context:theWaitingContext}}
Fail. Fail. Fail. Fail. Fail.

So, create my own context and set it later…

set newContext to make context with properties: {{name: theNewName}}
Fail. Fail. Fail. Fail. Fail.

Lo and behold, I finally find out why creating a context isn’t straightforward… Because you have to do something like this:

HOW? HOW ARE YOU SUPPOSED TO JUST KNOW THAT????

A Lovely Script for You

At the end of the day(s), I was able to make it work.

I can now select a bunch of tasks.

Hit a button in my OmniFocus task bar, get a dialog like:

And, after hitting Send It! the script automagically (for each task):

  1. Marks the task as complete
  2. Creates a new task, with the due and defer dates and a context (it creates those variables if they don’t already exist)
  3. Sets the context to the name of the person in the dialog above (and, yes I have a brady context already in OmniFocus)
  4. Generates an email to the person named in the list with all the new tasks as omni focus links.
New tasks with due, defer, and context (the notes append the date the task was sent)
This works on both Mac and iOS, but it’s best to open these in iOS because the Mac version of OmniFocus doesn’t handle URL Schemes very well yet.

Here’s the script.

You can grab a copy of the script here:

Enjoy telling people what to do…

❤,
T