Bookmarklet to add the currently viewed web page to Omnifocus

Posted on: 13th Mar, 2009 in Software

Image to support this article

A couple of problems I came across whilst using OmniFocus were that:

  • whilst on the Mac the the 'Add to Inbox' keyboard shortcut doesn't work inside Firefox
  • when I am away from my Mac (i.e. at work on my PC) I have no way to send stuff into OmniFocus for later (of course, I could use the iPhone app, but typing out long protracted URLs isn't the best use of my time!)

So I set about writing a bookmarklet for my browser that would take the web page I'm looking at, wrap it up in an Gmail/Google Apps email and send it to an 'unused' email address (I use my MobileMe one) so that later, when I start up Mail.app on my Mac OmniFocus would process them into its inbox.

Setting up OmniFocus

If not turned on already, go into OmniFocus' preferences, go to the Mail settings and use the check box to create the Mail.app rule to process Omnifocus actions in the inbox.

Writing the bookmarklet

Here is the initial code for the bookmarklet:

The procedure

  1. If you use Google Apps, you need to replace the trailing mail in https://mail.google.com/mail/ with a/YOURDOMAIN.COM/ so it becomes https://mail.google.com/a/example.com/?view etc.
  2. Add your email address where indicated
  3. Copy it all
  4. Right-click on your toolbar and click new bookmark
  5. Give it a name (e.g. +Omnifocus)
  6. In location paste the code you copied from the text box above
  7. Click OK

That's it.  Next time you are on a web page that you want to save for later, simply click the bookmarklet button.  The email will pop up.  you can change stuff, added extra text into the body field (which gets used as the note) and press send.  The item will end up in your inbox (the task name will be prefixed with [Web clip] so that you can easily spot them/search for them.

Some things to know

Your destination email provide might not support emails like name+omnifocus@example.com so you may need to use the other way Omnifocus allows, which is to prefix the subject with something as described in the OmniFocus preferences.

If you didn't select any text on the page, the document title will be used as the task name.  If you did have some text selected on the page, that will be used for the task name.

Customising the bookmarklet

You could change the prefix ([Web Clip]) to something else, or remove it completely.

You can add contexts (for example, you may think that everything that you will be clipping needs to be done online, so you need to add @online after the subject

You can add start dates, due dates.  All the things as outlined in the OmniFocus user manual.

If you find any problems with it, have any difficulties in customising it the way you want (I certainly did!), please leave a comment below and I'll see if I can help.

Comment

Emily H said: This is genius! Thanks for creating and sharing this Paul!
Posted on Jul 03rd at 11:24 AM
.(JavaScript must be enabled to view this email address) said: Just Awesome smile Thank you Paul! a little extension for those who like to add selected text into the email (adapt the code as described above!): [removed](function(){x=document;y=window;if(x.selection){sel=x.selection.createRange().text;}else if (y.getSelection){sel=y.getSelection();}else if (x.getSelection){sel=x.getSelection();}if (sel==''){sel=document.title;}m='https://mail.google.com/mail/?view=cm&fs=1&tf=1&to;='+encodeURIComponent('YOUREMAILHERE')+'&su;=[Web clip] '+encodeURIComponent(sel)+'&body;='+encodeURIComponent(document.title)+' at '+encodeURIComponent(document.location)+' text-snippet: '+decodeURIComponent(document.getSelection().replace(/\s/g, ' ').replace(/ {2,}/g, ' ' ) );w=window.open(m,'addwindow','status=no,toolbar=no,width=575,height=545,resizable=yes');setTimeout(function(){w.focus();}, 250);})(); If there is no text selected before pressing the bookmarklet there is nothing added but "text-snippet:" (remove it if you like wink greez JoH
Posted on Aug 25th at 05:21 PM

Name:

Email (required, not displayed):

URL (not displayed):

Your comment:

Remember my personal information

Notify me of follow-up comments?

Please enter the word you see in the image below:

Email Newsletter

Why not subscribe to my email newsletter containing latest news and tips?

You can unsubscribe at any time and your details won't be passed on to any third-parties.

Request a quote

Let's start talking about your project. Just send an enquiry in via the contact page or call me on the telephone and we'll take it from there.

Contact