Create OmniFocus Tasks with AppleScript

Sometimes efficiency becomes the enemy. Because I'm now a believer in automating document filing via Hazel and OCR, I sometimes get myself in trouble. A case in point is my life insurance bill. It arrives every quarter. I used to scan it and then name it in my Action folder with a TextExpander snippet, which resulted in it getting sent off to a nested folder somewhere. At the same time I'd record an OmniFocus quick entry to pay the bill. It was all second nature. These days, I use a Hazel rule that looks at the contents of this invoice and names it and files it without me having to trouble to rename the file manually. Put simply, once I scan it, I never see it again unless I go looking for it. The problem is I keep forgetting to create the OmniFocus entry to pay the bill. That's bad. (Especially if I get hit by a bus, which would only add one more problem to cascading badness.) We can't have that.

I decided to create an AppleScript that automatically creates an OmniFocus task when this Hazel rule triggers. After a lot of head scratching, trial and error, and even some help from friends at the Omni Group and Ben Waldie (my AppleScript Sensei), I've cobbled one together. Here is a screenshot and the AppleScript code.

-- Lovingly crafted by David Sparks, The Omni Group, and Ben Waldie --

set theDate to current date
set theTask to "Pay Life Insurance"
set theNote to "Lovingly Scanned by your Mac on " & (theDate as string)

tell application "OmniFocus"
tell front document
set theContext to first flattened context where its name = "Tech"
set theProject to first flattened project where its name = "Finance"
tell theProject to make new task with properties {name:theTask, note:theNote, context:theContext}
end tell
end tell

To test the rule, open AppleScript Editor and copy it in. You need to change the context and project names to something that is in your OmniFocus library. Once you trigger it, AppleScript will create a new task in the designated project with the designated context. The task also gets named and the Note field will include the text "Scanned on {today's date}". This just happens. Don't believe me? Go look in your OmniFocus project afterward.

I use this script directly in Hazel. Specifically, when I've got a scan that requires future action, I add an AppleScript Hazel action at the end to run this script. After Hazel gets done naming and filing my document, it creates a handy OmniFocus task. Below is my life insurance Hazel rule screenshot to demonstrate.


I've modified several versions of the script to handle the variety of documents I scan and OCR that require an automatic OmniFocus action. Creating an OmniFocus task with a script is damn useful. You could use this in a lot of contexts outside of document filing. You're welcome.

Below is a download link for the Hazel rule. Go nuts.

Download Sample Hazel Rule

OmniFocus Forecast and Start Dates

A surprising number of attendees at my Macworld talk about OmniFocus were not aware that you could show start date items in the iPad version’s Forecast View. This is super useful. Here is the setting.

I use this every afternoon as I clear out my current day and look forward to the next. I also use it on Sunday to take an overview of what I’m up against in the following week. If I have days that are full of appointments AND 60 tasks assigned to the day, I make a decision and either move tasks, appointments, or both. Go nuts.

OmniFocus iPhone Update

If you use start dates to manage tasks in OmniFocus, you are going to like the most recent iPhone app update. You now can view tasks by start date in the forecast view. This matches the feature currently available on the iPad version and explains why I do most of my OmniFocus planning these days on iOS devices.

OmniFocus and Windows

A lot of people ask me how I get by using OmniFocus when I spend time every day on a Windows machine. I’ve never clamored for a Web-based or Windows version of OmniFocus. I’ve always viewed the Windows computer as a device to accomplish very specific tasks, none of which involve managing my task list. This became even more pronounced with the iPhone and iPad versions letting me view my OmniFocus data while sitting at the Windows machine. Indeed, the iPad has become my primary window to my OmniFocus data. I use it more than the Mac. Anyway, there is no need for me to write a long post about Windows and OmniFocus anymore because this morning, Eddie Smith nailed it. is sponsored by Bee Docs Timeline 3D. Make a timeline presentation with your Mac.

OmniFocus for iPad 1.3, See Tomorrow Today

I heard this update was coming last week and have to admit I’ve been checking the iPad App Store several times a day lately. iPad OmniFocus version 1.3 warms the cockles of my heart. It was just a few days ago that I wrote about the Omni Group and iteration. Well let me just say that The Omni Group just iterated the hell out of iPad OmniFocus and now it is available for download.

The new version takes the already useful Forecast view and turns the dial up to 11. The new Forecast mode adds a calendar bar to the bottom of the screen so you can see calendar items in the forecast view. Also, you can toggle it to also include tasks with start dates on the forecast days. If you lasted through my 2 hour screencast deathmarch of OmniFocus ninja tricks, you already know I use start dates extensively to manage my tasks. Now I can see what is up tomorrow, or three days from now, along with the calendar items for that day. I’ve been asking for this feature for years and the implementation is great. With this update, iPad OmniFocus becomes even more prominent in my task management workflows. Good times.

There is a lot more to 1.3 including full screen note editing, better badge counts, gestures showing up when mirroring, and other improvements. The Review sidebar is also now sorted in Library order, which is an improvement.

Automating OmniFocus Task Entry

Since publishing the first screencast on capture, I’ve received several e-mails asking for a way to automate task creation based on a text list. The idea is making a task list in a text file and having your Mac convert it to tasks. While I haven’t looked into this, Josh Betz did and came up with this nifty AppleScript.

Despite Josh’s scripting prowess, I’m still adding tasks from a text list manually. I do this because quite often something that seems like a good idea when I peck it into a text file, like perhaps running with scissors, doesn’t pass the sniff test when it comes time to add the tasks to OmniFocus. Moreover, it really isn’t that hard to add new tasks to OmniFocus directly on your Mac, iPhone, or iPad.

OmniFocus Screencast Follow Up

Thanks everyone for the comments and questions about the second OmniFocus Screencast.

There were a few questions in the feedback here and at MPU. I’m responding to them with this post.

What no single action lists?

I didn’t cover it but I do occasionally use single action lists. I generally think in terms of projects.

I wonder how many tasks you manage in OF, and how many NA’s you have on your plate on a regular day?

Currently: 197 Projects, 1470 Actions

A lot of the projects are sequential. It takes me about 20 minutes to clear the inbox in the morning and it ranges between 30 and 80 actions. The actual daily list is usually about 30. These numbers are skewed however. I’m an attorney. I run a nerdy blog and podcast. I write books. I’m a dad. I’ve got tasks telling me to pick expert witnesses in nine months and reviewing corporate strategies with clients in two years.

And do you really abandon the use of contexts (given your Day Start perspective, which is grouped by project? And what makes this in your opinion different from a Project View?)

I don’t abandon context view. That comes in Episode 3 but I use context mode all the time during the day (usually on the iPhone and iPad) to knock tasks down.

How do you manage tasks you keep putting off? (When do you kick them out/alter them/etc.).

It’s all about the review. Be brutally honest. If it is not going to happen, kill it. Stay tuned for episode 3.

Do you create start dates for both projects and action items?

Action items: Usually.

Projects: Not usually but on occasion. When I do set them, they are normally with repeating projects.

Do you use the same methodology for “due dates” [use only if 100% necessary] for your calendar too? Picking tasks every morning seems reactionary and less intentional then scheduling out important projects. How do you schedule a meeting in OF / sync up your calendar?

I don’t schedule a meeting in OF. I set meetings in my calendar. I may have some tasks for an important meeting that requires preparation. Those tasks normally have a due date the day before. I think I talked too much about the peril of due dates. I use them all the time. I just don’t over use them so I don’t ignore them when they show up. Before I figured this out, I’d have 20 due items and OmniFocus felt like the boy who cried wolf.

If there is an item in your inbox that is less than 2 minutes to complete (for example: write quick email to David), do you simply punch it out and check it off as you are processing inbox?

Small items like that don’t even land in OmniFocus. I just do them.

The idea of Someday/Maybe lists is to have a place to park things that are grabbing your attention…but that you don’t have a specific commitment around. It sounds like you’re already doing this in a sense and are creating a reminder for yourself to revisit these items within a finite amount of time (e.g. 3 months). An alternative would be to revisit these items as part of a weekly review…or even once a month in some cases.


Do you use OF to keep lists of books to read, videos to watch or is OF not really ideal (ironically) for lists of potential items?

I don’t use OmniFocus for this. I used to do it in Zenbe Lists. About a year ago I moved the lists to Simplenote.

I am using Projects for my clients and am curious why you use Folders instead. Thanks again.

Often I’ll have multiple projects for a single client. (i.e. Apple Corporate General, Apple v. Samsung, MultiMillion $$ MacSparky Acquisition)

The Next Episode

The next episode should publish on the weekend of May 14. That episode will focus on getting tasks done and review. I’ll also do some follow up if there is time so get your questions in.

OmniFocus Screencast Update

I’m getting lots of e-mails on the promised screencasts. The first one is nearly done and should go live next weekend. Two more will follow up in two week increments after that. They will be in the Mac Power Users feed, among other places. I’m having a lot of fun making them and they are looking great. I can’t wait to share these.

Do Stuff

The above is one of my favorite slides from my OmniFocus presentation at Macworld. A little known secret about me is that in addition to being a computer nerd, I also enjoy woodworking.

Several years ago a friend gave me an amazing Japanese pull saw. I love this saw. I could spend hours polishing and sharpening it. But at the end of the day, I need to cut wood. The same can be said about a task management application (or any fiddley productivity software). You can spend all day adjusting settings, prioritizing tasks, and setting estimates or you can get stuff done.

When I first started using OmniFocus, I often caught myself using it as a procrastination tool. Rather than actually checking off items, I would spend hours on end organizing and prioritizing my data. Although I can be dense, when I realized that at the end of the day I still had most of the same uncompleted tasks I had at the beginning of the day, I knew there was a problem.

The trick to using OmniFocus (or any productivity application) is to not let it govern you. Use it as a tool. For me, this means I open OmniFocus in the morning for about a half-hour and I set priorities and plan my day. In the late afternoon I go back in OmniFocus and audit what happened and make plans for the future. That’s it. I spend the rest of the day checking off items and doing stuff. The iPhone and iPad OmniFocus apps are great for this. They make it easy to see your tasks and check them off as you go along.

So the next time you catch yourself in the middle of the day wasting hours “planning,” or setting iTunes metadata, or cleaning out your address book, shut the lid and get back to sawing wood. is sponsored by Bee Docs Timeline 3D. Make a timeline presentation with your Mac.

Tweaking OmniFocus: Project Template Applescript

OmniFocus is an amazing tool. I need this app like Smeagol needs his ring. If I don’t do my morning task audit, I get the shakes and start blurting out incoherent rambling about blown deadlines and crashing plates.

One feature missing in my precious however is the ability to create project templates. Everybody has some little group of tasks that gets repeated. For instance, I had a set of tasks that got repeated for each chapter of The Book. So how do I use this unsupported feature in OmniFocus? The answer is Applescript, that ubiquitous tool (that almost nobody uses) that lets you add features and bolt applications together like so many pieces of a digital erector set. In this case, I didn’t even write the script myself. Instead, I downloaded from Curt Clifton’s outstanding collection of OmniFocus scripts. Specifically, I’m using the Populate Template Placeholders script.

The download includes instructions but since so many find Applescript intimidating, I’m going to walk through it.

First a word about Applescript

Applescript is Apple’s own natural language scripting language that lets Macintosh applications hook up. You can tell one application to generate data and then send that data to a different application to lay it out, or print it, or post it to the Internet. It enables you to make your good apps great and your great apps awesome. It takes a little bit of time to figure out. The best way to learn it is to buy Sal’s book.

Regardless, even if you don’t want to learn Applescript, you can still use it. People like Curt develop all sorts of useful scripts and then post them to the Interwebs. You just download, install, and use without knowing a lick of Applescript code. This template script is just such an example. So here is how you go about it with my Mac Power Users show template:

Step 1: Install

Download the script and copy the script file to your script directory, located at:


Most likely you don’t have an OmniFocus directory, so create one.

Step 2: Create

Create a project template in OmniFocus. This is set of tasks the Applescript will copy and populate for every new instance of the project.

Starting out, it looks just like any other project you may create except this one is more generic and includes Placeholders (nerd translation: variables). Placeholders are declared by adding them to the last line of the Notes section of the project description. They get surrounded by guillemets, those double-bracket looking symbols «like this». You can create them on a US keyboard by pressing (Option + \) for « and (Option + Shift + \) for ».

Once declared you can add the Placeholders to your project name and task items. As you can see from the example, I’ve created placeholders for the show name and show number. (If you want to prove your geek cred, open the Applescript and change the Placeholder symbols to something else.)

Step 3: Run

You can run the script from the script menu in your menubar. If you don’t see the script menu, which looks like this …

you can enable it in the preference pane of Applescript editor, an application on every Mac found in the Applications/Utilities folder.

Once you trigger the script, Applescript prompts you for the Placeholder variables …

and creates a new project replacing the Placeholders with your supplied data. Once you’ve got the script installed, setting up new templates projects takes a fraction of the time it did before.

Step 4: Drag

Drag the newly created project to wherever it belongs in your OmniFocus Project list.

Bonus Points

If you want to add start and due dates to templates projects, go nuts. The project itself, however, must have a start or due date in order for it work. Alternatively, if you add a line to the Project Template Note (above the Placeholder line) that reads Due date is, you will be prompted to type in your dates when you run the script. While I like start dates, I’m not a big fan of due dates and prefer adding dates (if any) manually later.

If you like the script, send Curt a thank you note for making this possible. is sponsored by Bee Docs Timeline 3D. Make a timeline presentation with your Mac.

Adding Tasks to OmniFocus with E-Mail

One of my few complaints with OmniFocus for iPad in my review is its inability to process tasks directly from the mail application to OmniFocus. On my Mac, I often blitz through my inbox creating future tasks with daily e-mail. That is not possible on the iPad, or is it?

Reader Pierre sent me a note to remind me about OmniFocus’s ability to process e-mails into your task list. OmniFocus lets you send yourself specially formatted e-mails that will process directly into your OmniFocus inbox.

To set it up, use the OmniFocus Mail preference pane and select the Add Mail Rule to create OmniFocus actions checkbox. You can have OmniFocus look for any messages that have +omnifocus before the @ sign in the destination address, as in If everything goes to plan, the message will arrive in the correct mailbox as if the plus sign and the extra word were not there and the message gets delivered to your OmniFocus inbox. Alternatively, you can provide a special code for the the message subject line. I use three dashes. Next, you can instruct OmniFocus to file the received message. I dump them in my Archive, as shown below.

The Allowed From addresses list is automatically filled with any email addresses on the “Me” card in Address Book. This way, everyone who reads this post can’t contribute to my task list by sending me an e-mail beginning with three dashes.

I find simply getting the messages in my inbox is enough. I then process and categorize the messages from inside my inbox on OmniFocus for iPad.

If you want to add more data to the new task item, the syntax is powerful. Here is the breakdown from Omni’s help file:

The subject and body of the message are joined into a single block of text. The first line and any other lines starting with (double-hyphens) become new actions. Other lines become notes for the preceding action.

To specify a project, use > (greater-than sign) or :: (double-colons), followed by a project name or abbreviation. The colons are nicer for the iPhone because they are on the first shifted keyboard rather than the less-accessible math keyboard. The project string is matched exactly as if it was entered in a project cell in OmniFocus.

To specify a context, use @ (at sign), followed by a context name or abbreviation. Like project names, the context name is matched exactly as it would be in OmniFocus.

To enter start or due dates, use # (number sign), followed by some date expression. The same expressions you use in OmniFocus (tomorrow, 9-30-2008, 2w, and so on) can be used in mail messages. If there is only one date, it becomes the due date. If there are two (each with its own number sign), the first becomes the start date and the second becomes the due date.

To enter a time estimate, use $ (dollar sign—time is money) followed by some duration expression (like 5m, 1h, and so on); you can use the same duration expressions that you use in OmniFocus.

To flag the action, use ! (exclamation point) at the end of the action title. You can also add a note on the same line as an action title by separating them with // (double-slashes). Anything after the double-slashes becomes a note, but double-slashes in a URL like don’t count.

As you can see, you could really go nuts. The only downside to this feature is that in order for it to work, there has to be a Mac somewhere in the universe running Mail and OmniFocus at all times to process the tasks for you. If your laptop remains in your bag, nothing is going to happen.

For the daily grind, I continue to process my inbox at then end of the day and use the OmniFocus Clip-o-Tron 2000 to send new messages to tasks. However, if I am flying solo with the iPad for more than a few days, I’ll go activate this mail rule and leave Mail and OmniFocus running on my home iMac so I can continue to process mail.

Using OmniFocus Perspectives

I’ve written and talked a lot about my favorite task management application, OmniFocus, over the years. One of the most frequently asked questions I receive are concerning my perspective settings. In addition to Omni’s built-in perspectives, I’ve rolled a few of my own.


Here is the perspective set up.

This is the perspective I use in the mornings to work through the day. It lists all projects with tasks available. One of the criteria for a task to be available is that it have an available start date. If you have an item marked not to begin until the next day (or next month), it won’t show up in this view. Using the tab key, I can fly through my task list in the morning. If there is a task showing up that I don’t intend to do today, I move the start date forward. You can push it two days by typing “2d” or move it to one week from monday at 2:00 p.m. by typing “1w mon 2pm” or August 7 by typing “8/7.” I get through my entire task list every morning in about 20 minutes. The trick is to be realistic about what you can get done in the day.

Since none of the OmniFocus built-in icons really fit, I extracted the icon file from iCal and imported it in the OmniFocus Perspective icon menu. Here it is.


Here is the perspective set up.

Despite my best intentions, some days things go a bit sideways and my morning task sort goes largely ignored. At the end of those days, I open the Clear perspective that just gives me a list of all of the available tasks without any sort. The advantage of this perspective is the ability to easily select and process multiple items using the OmniFocus Inspector.

Maybe I’ll move a bunch of items to tomorrow. Maybe I’ll send items to next week. If the day was really bad, I may send them all out two days and head to the beach. The point is, when I’m done, my day is clear.

Focussed Perspectives

Even though the word “Focus” is in the name, a lot of people don’t realize you can tell OmniFocus to limit your view to items in a given folder, project, or context. If you have a folder with all your work projects in it, Focus on that folder while at work. You can custom save that view as a perspective so tomorrow you can get there faster.

Finding Your Custom Perspectives

Once you have your custom perspectives you can access them in the Perspectives menu item, assign them keyboard shortcuts in the perspective window, or open the toolbar editor and copy the perspectives into your toolbar.

So there you have it. OmniFocus Perspective bliss. Share your favorites in the comments.

OmniFocus iPhone 1.6

The new version of OmniFocus for the iPhone has been out a few weeks now and it is a big improvement over prior versions. The Omni Group is getting very efficient at syncing large databases over 3g and WiFi networks. The increased syncing speed makes it really easy to access, update, and use your task list anywhere.

Dragon Voice and OmniFocus iPhone Workflow

I've been using Nuance's Dragon Dictation on my iPhone now a few weeks. One of my favorite uses for it is dictating task item into OmniFocus. Dropping new items in the inbox is simple.


Dictate the task into Dragon


Copy the task to clipboard

Open and paste the task into OmniFocus.


The Task Is In

Note that OmniFocus allows you paste items in the inbox even while the database is still updating. This has largely replaced my prior use of the Note2Self app where I would dictate new tasks and then process them after receiving the audio files. I know there are also other options, like ReQall but I prefer the above method.

Also note Nuance has updated the Dictate app allowing you to opt in (or opt out) of sharing your contact names. I know a lot of people felt this was a security risk. I don't think it is that big a deal and uploaded mine.