OmniFocus clippings from Firefox
by Martin on 1/08/2008Edit: An alternative version brings up your Quick-add dialog and populates it. Check this comment if that sounds more appealing.

To get this to work you’ll need Quicksilver. But you’ve got that haven’t you? Sure you do.
I’m trying out OmniFocus nowadays for my obsessive-but-not-GTD-level organizing needs. It’s still a tad overkill for what I need, but they have the best iPhone sync so far, and I assume I’ll just be assimilated into the cult of David Allen sooner or later so what the hell.
One of the things I like about OmniFocus is the “Create Clipping” functionality. OmniFocus allows you to at a keystroke (♥) send whatever text is currently selected to your Inbox as a clipping.
However this isn’t working in Firefox 3. Mozilla practically stripped all the scripting abilities in v2 and i suppose that’s what goes for a “feature” nowadays. This needs some serious fixing. Let’s get our hands not-really-dirty-but-maybe-a-bit-smudged.
Edit: I’ve updated the script with a new version that also grabs the URL of the clippings origin.
So the situation is as follows:
- OmniFocus lets you assign a hotkey to save whatever text is selected (in supported applications) as a Clipping. This is awesome, and if you copy i.e. from Mail.app OmniFocus will include the header info for the clipping. I want to use ⌘-F3 as my OmniFocus hotkey.
- Firefox is my browser of choice, and I’m pretty sure that about 90% of my clippings would be from my browser. However Firefox doesn’t support the OmniFocus clippings hotkey.
- However! OmniFocus also comes installed with a Quicksilver action appropriately named “OmniFocus: Send to Inbox”. Now we’re getting somewhere.
The fact that there’s a handy Quicksilver script is enough to cut loads of time creating a clipping. Consider this:
Creating a clipping from Firefox with/without Quicksilver
The default process to create a new clipping from Firefox:
- 1. Select text in browser.
- 2. Hit ⌘-C to copy the text.
- 3. Tab over or click in dock to activate OmniFocus.
- 4. Click the inbox.
- 5. Hit enter.
- 6. Hit ⌘-V to paste.
- 7. Tab over or click in dock to activate Firefox. You’re done!
Now consider the same operation in Quicksilver:
- 1. Invoke Quicksilver (I use ⌘-Escape ).
- 2. Hit “.” to start typing.
- 3. Hit ⌘-V to paste your clipping.
- 4. Tab over to the next pane and type “Sen” if “OmniFocus: Send to Inbox” isn’t already selected.
- 5. Hit enter. You’re back in Firefox.
A huge advantage with the second method over the first is that the Quicksilver action will also include the title of the webpage you clipped the text from. (Sadly not the URL. As mentioned: Get with the program Mozilla!) Also of course, it requires fewer steps and is faster… Not by a hell of a lot though. Let’s shave a few steps of that workflow.
Open your Quicksilver preferences and select the item “Actions” in the sidebar. In the next list select “Text”. What we’re going to do now is to drag the item “OmniFocus: Send to Inbox” to the top of the list, thus making it the default action whenever you paste or type text into Quicksilver.

So that’s pretty good. 1. Copy. 2.Invoke Quicksilver, 3. Paste, 4. Hit return.
But we’re not done by a long shot. I want the one-click solution. Select text and Boom! There she flies. So let’s make that happen.
I looked around at the google but couldn’t really find a good solution for this so I broke out my trusty, somewhat rusty, Script Editor. What I’m about to do could probably be done faster in Quickeys, but I really don’t like some of the Quickeys methods I’d have to use, so AppleScript it is!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | tell application "Firefox" activate end tell tell application "System Events" to keystroke ¬ "c" using {command down} delay 0.2 tell me to activate set selecTxt to the clipboard as text tell application "System Events" to keystroke ¬ (key code 53 using {command down}) tell application "System Events" to keystroke ¬ (key code 47) tell application "System Events" to keystroke ¬ "v" using {command down} delay 0.2 tell application "System Events" to keystroke (key code 36) tell application "Firefox" activate end tell |
What we have here is an AppleScript that automates the entire 4-step process above! You select the text, invoke the script through a hotkey you define in Quicksilver and we finally have one-click clippings from Firefox!
But hold your horses. Let me show you how to set up that Quicksilver trigger, and on the way point out some problems. Open your Quicksilver preferences again and this time go to the “Triggers”-tab.

Click the + to create a new trigger and type in the first few letters of the name of the script. When you’ve found it click the “Action” field and type “Run”. Now click the little “i” in the bottom of the window and choose a good hotkey. The hotkey should now work as advertised.
But consider this:
- 1. We only want the script to run from Firefox. That sequence of commands could mess stuff up if it’s pressed in, say IfYouPressAnyKeyTheWorldBlowsUp.app. Now, Quicksilver has a neat little feature called “scopes” that ensure that hotkeys can only be triggered in predefined apps. How neat. Sadly it doesn’t work at all under Leopard. Why can’t shit just work!
For this reason the script tells Firefox to activate as it’s first command. - 2. Now we have 2 hotkeys that serve basically the same purpose! One for all the cool apps that support OmniFocus-services and one for that weirdo Firefox which doesn’t.
Unacceptable! Let’s add some lines to the script.
Updated script. Will now also grab the URL of the page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | property theUrl : "" property theNote : "" property theDelimiter : " ------------------------ " property sendOff : "" if application "Firefox" is frontmost then tell application "Firefox" to activate tell application "System Events" to keystroke ¬ "c" using {command down} delay 0.2 tell me to activate set theNote to the clipboard as text tell application "Firefox" to activate delay 0.1 tell application "System Events" keystroke (key code 37 using {command down}) keystroke "c" using {command down} end tell delay 0.1 tell me to activate tell application "System Events" set theUrl to the clipboard as text set sendOff to theUrl & theDelimiter & theNote set the clipboard to sendOff end tell delay 0.1 tell application "System Events" keystroke (key code 53 using {command down}) keystroke (key code 47) keystroke "v" using {command down} delay 0.2 keystroke (key code 36) end tell else tell application "System Events" to keystroke ¬ (key code 99 using {control down, command down, ¬ option down}) end if |
So what’s happening here is this: I want my OmniFocus hotkey to be ⌘-F3 so what I’m gonna do is to define the hotkey in OmniFocus’ preferences to be something else. A key combo I’m not very likely to press, such as ⌘-⇧-⌥-F3. Then I assign the ⌘-F3 hotkey to the AppleScript from within Quicksilver (as showed above). Now whenever I hit ⌘-F3 is this (in pseudocode):
1 2 3 4 5 6 7 8 | if Firefox is the current application keep running this script if Firefox is NOT the current application hit the following keys ?-?-?-F3 |
There. The script can be downloaded here. Please note that you’ll have to change the key codes according to what key combos you want to use. You can use the Freeware app Ukelele to help you figure out what the corresponding key code is for whatever you want to use.
There are 6 comments in this article: