Sep
6
2012

Create OmniFocus Tasks From Drafts, Scratch, Or Any Text Editor Through Dropbox

Posted by at

Back in October 2010, I posted a tutorial on how to add new tasks to OmniFocus or Things using Dropbox, AppleScript, and PlainText by Hog Bay Software. In June 2011, I wrote about more ways to add tasks to OmniFocus (my GTD app of choice), and noted how I had only “scratched the surface of what’s possible to do with OmniFocus and task creation”.

I decided to slightly revisit my workflow now that several “quick Dropbox note-taking apps” like Scratch and Drafts have come out. These apps are already integrated in my daily routine, but the following method works with any text editor, and, obviously, using Dropbox is recommended if you want to be able to create tasks from anywhere.

The 2010 workflow relied on separate text notes to process the contents of a file, and turn it into an inbox task. Thanks to these new apps’ “append” functionality, we can now rely on a single text file (I called mine “OF.txt”) to convert every single line to a new task. The process is very simple, and apps like Drafts and Scratch can append text in seconds, making it extremely easy to capture anything in seconds, so you can come back to your Mac to find new tasks ready in OmniFocus.

In Drafts or Scratch, pick the text file you’re going to append text to. The advantage of this workflow is that, whereas OmniFocus for iOS is a fantastic app, adding new tasks to the inbox isn’t exactly quick, as you often have to wait for the app to refresh the sync database, which can be slow on 3G. I want to be able to capture ideas (that will later become tasks) with ease, and plain text delivers on this need.

On the Mac, you just need to monitor the OF.txt file for changes, and run an AppleScript to add lines of text as tasks to OmniFocus. You can do so by using Folder Actions Setup (as I detailed in October 2010), or, even better, Hazel. In case you missed our coverage, you have plenty of reasons to be using Hazel (see also: Hazel 3.0 on Mac Power Users Episode #79).

set p to POSIX path of "/Users/viticci/Dropbox/Apps/OF.txt"
set input_file to POSIX path of p
set l to paragraphs of (do shell script "grep . " & input_file)
do shell script ">" & input_file

tell application "OmniFocus" to tell document 1
	repeat with v in l
		make new inbox task with properties {name:v}
	end repeat
end tell

The script was created by Josh Betz, and it’s very simple. In the first line (make sure to be using the version he posted in the “Update” of his post), replace the path with your OF.txt file. For some reason, Hazel was throwing an error on the script for me, so I had to add an additional line as you can see in the screenshot above. Once processed, the contents of the text file will be cleared.

A simple and elegant solution to a common problem, this will allow you to enjoy the simplicity of plain text and speed of apps like Drafts and Scratch, while keeping track of your tasks using OmniFocus. As I mentioned above, you can use any text editor to add new lines to the text file (though auto-save might be tricky to deal with — you don’t want incomplete lines to be saved in OmniFocus), but I just like Drafts and Scratch better for this job.

You can find the script here, and you get the apps by following the links below.

- Drafts for iPhone – $1.99

- Drafts for iPad – $2.99

- Scratch – $2.99

• You should follow the author on Twitter here.