An OmniFocus Create Task Bookmarklet

Create a task with the current URL

by Colter Reed
2:07 read (647 words)
by Colter Reed
2:07 read (647 words)

I often find myself needing to come back to a page later. I used to just leave the page open in another tab, but that can quickly get out of hand. Then I tried adding the pages to Pocket, but they would get lost with the articles I just wanted to read later. I wanted a way to add the current page to OmniFocus with just a click. All it takes is a little JavaScript.

A bookmarklet is a little piece of JavaScript code that’s saved as a bookmark. When you access the bookmark, the script performs an action with the current page instead of taking you to a saved page like a normal bookmark.

Installing the Bookmarklet

To install the bookmarklet, drag this to your Favorites bar in Safari (or Bookmarks Bar in Chrome):

New OmniFocus Task…

Now, when you click the bookmarklet, the OmniFocus quick entry panel will pop up. The name of the task will be the title of the current page and the note will be the URL.

Bookmarklets will also work on iOS. Tap the bookmarks icon in Safari and choose the bookmarklet from the menu that pops up. Let Safari sync your bookmarks, and you have the same shortcuts on your iPhone or iPad.

(For a laugh, also check out Bacolicio.us (add bacon to any page), OmNomNomify (add Cookie Monster to any page), and WebsiteAsteroids, which lets you blast your way through any page.)

Assigning Keyboard Shortcuts

The problem is that it’s easy for your Favorites bar to fill up and become unmanageable. I wanted a way to always be able to quickly invoke the script, even if the Favorites bar wasn’t visible. The solution? A custom keyboard shortcut.

Safari and Chrome give every bookmark their own menu item. In Safari, the bookmarklet I had just dragged to the Favorites bar was under Bookmarks > Favorites Bar > New OmniFocus Task…. (In Chrome, it would have been Bookmarks > New OmniFocus Task….) To give a bookmarklet a custom keyboard shortcut:

  1. Open System Preferences.
  2. Click on Keyboard.
  3. Click Shortcuts.
  4. Click App Shortcuts on the left.
  5. Click the plus button under the right-hand side.
  6. For the Menu Title, use the name of the bookmarklet.
  7. Click in the keyboard shortcut field and type the shortcut you want.

I set the shortcut for all applications because I switch back and forth between Safari and Chrome frequently. This way, I set the keyboard shortcut once and it works in both apps.

The one downside here is that it seems like the browser can sometimes ignore the keystroke, even though clicking on the bookmarklet in the Favorites Bar or Bookmarks menu works fine. It seems to work most of the time, though, and I haven’t figured out yet what can cause it to fail. YMMV.

I’ve done lots of bookmarklets before, and I regularly set custom keyboard shortcuts for apps to get an app to work the way I want it to. By combining the two techniques, you can extend your browser’s functionality and invoke it with the keystroke of your choice.

What’s your favorite bookmarklet? Your favorite blindingly-obvious-once-you-learned-it shortcut? Share in the comments below!