Here’s my new favorite way to get tasks into TaskPaper. It’s a combination of Drafts, Dropbox, launchd, a Python script, and a shell script.
That sounds convoluted, but once each piece of the pipeline is in place, I just enter one or more tasks into Drafts on my phone, and three seconds later, it is in my TaskPaper file on my Mac. It’s like iCloud, but without the mystery.
I wrote a Python script to insert new tasks in the proper place in my TaskPaper file. Since TaskPaper files are just plain text, this is not too complicated.
My script reads in a text file and interprets each line as a new task. If the task has a project tag, it removes the tag, and then it groups the tasks by project. Anything without a project is assumed to be in the inbox. Next, it reads my main TaskPaper file, and figures out where each project begins and ends. Finally, it inserts each new task at the end of the appropriate project.
A shell script calls the Python script with the correct arguments, merging
inbox.txt file into my
tasks.taskpaper file, and deleting the
inbox.txt file. Update: To avoid corrupting
my TaskPaper file, I use some AppleScript within this shell script
to first save the file if it is open.
(Of course, the Python script could have done these last steps also, but it’s much better to make the Python script generic, so I can use it for other purposes.)
The next step is to automate the merging. This is where OS X’s launchd is useful. One solution would be to run the shell script on some kind of timed interval. But launchd is smarter than that.
WatchPaths key, I can have the shell script run whenever my
file is modified.
Since OS X keeps an eye on all filesystem changes, this actually
has a very low overhead and means that my shell script will be run within seconds
of any modifications to
Here is my Launch Agent definition, stored in a plist file in
With the hard work out of the way, I just define a custom Dropbox action in Drafts
that appends text to
inbox.txt in my Dropbox folder.
With no fuss, Drafts sends the new task or tasks off to Dropbox, which dutifully
copies them to my Mac, which springs into action, merging them into my TaskPaper
With so many applications and services fighting to be the solution to all of our problems, it is refreshing to see tools that are happy solving their portion of a problem and letting you go elsewhere to solve the rest.