Trac => OmniFocus Bookmarklet

A significant amount of my work comprises resolution of bug tickets, for the tracking of which Zenoss uses Trac. Since each of these usually corresponds to a single action in OmniFocus, I've been looking for an easy way to send a Trac ticket directly there (keeping a reference to the ticket in the notes field) other than typing it in manually, which is what I've been doing for months. Today I found it!First, I installed the OmniFocus URI Handler, which ingeniously parses URLs using the "x-omnifocus:" URI into OF actions. Since you can use OmniFocus's mail processing rules (e.g., "Do Something :: MyProject @ MyContext #Due // Note"), you can enter any kind of action you want by assembling the appropriate URL.

Once I installed this (trivial, just your basic .app dragged into /Applications), the rest was obvious. Here's the bookmarklet appropriate for my needs, with line breaks so it's readable:
javascript:<br />window.location="<br /> x-omnifocus://parsetasks?text=" +<br /> encodeURIComponent(document.title) +<br /> ":: Tickets @ Zenoss " +<br /> "#" + prompt("When is it due?") +<br /> "//" + encodeURIComponent(location.href);<br />

In my case, "Tickets" is the name of the single actions project into which I dump these, and "Zenoss" is the component I apply to them. I'm prompted for the due date (in a very non-GTD fashion, I use due dates as a rough way to manage priorities, in the absence of other mechanism), which, thanks to OF's acceptance of sensible expresions of time, I can enter like "3/3/2009" or "next thursday 5:30am". Finally, the ticket URL is put in the notes field.

Obviously, you'd want to customize the bookmarklet to suit your project and context, but this should provide you with a simple example. Here's the bookmarklet I use myself:

Trac > OmniFocus

Of course, this bookmarklet is generic enough that it'd work for any web page at all; it's just the title of the page and the URL.

Creative uses, anyone?


  • Anonymous  
    August 25, 2009 at 12:10 PM

    in your sample when using the bookmarklet it is inserting "–" (less the quotes) in the task title along with the project name and context. How can I correct this so that the project and context are properly parsed?

  • Ian McCracken  
    September 10, 2009 at 9:39 AM

    I fixed this myself by splitting out the part in parens, which is what's causing this. I changed document.title to document.title.split(')',1). The complete bookmark is thus:


Post a Comment