Saturday, October 6, 2012

Gmail RTM Bookmarklet

I am evaluating the Remember The Milk task management system.  They have a bookmarklet that does not provide (as of 2012-10-06) a way to record the URL of the page the task was added from.  I played around with the mobile versions of the bookmarklet posted to Using the mobile Add as a generic Quick Add tool including all fields forum thread and could not get it to work. So I based my own on a modified copy of the original Gmail This! bookmarklet and edited it to create a message body with the fields I needed, including the URL off the current web page.

This bookmarklet opens up a new Gmail compose window and adds the required info to the body of the message. It appends a note for both the document title and the current selection. You can then manually add additional text into that note which is typically what I need to do to provide extra info about the task.

I left the Due field blank, as I know I will have to type that in anyhow. This is different from what the standard RTM bookmarklet as it expects you to highlight text of a date and/or time as the Due date.

This is just GMail compose window, so there is no auto-completion of existing Tags, which is something the original bookmarklet does that mine does not. I don't miss that much as I know what my tags are, which are kept to be short names.

Here is the bookmarklet text:

java_script:popw='';Q='';rtmMail='CHANGE_THIS';x=document;y=window;if(x.selection)%20{Q=x.selection.createRange().text;}else%20if%20(y.getSelection)%20{Q=y.getSelection();}else%20if%20(x.getSelection)%20{Q=x.getSelection();}''+encodeURIComponent(rtmMail)+'&su='+encodeURIComponent(document.title)+'&body='+encodeURIComponent('T: '+Q+'\n')+encodeURIComponent('D: \n')+encodeURIComponent('U: '+location.href)+encodeURIComponent("\n---\n"+document.title+"\n"+Q+"\n"),'gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if%20(!document.all)%20T%20=%20setTimeout('popw.focus()',50);void(0);

How to install:
  1. Select the text above and copy it to the clipboard (CTRL-C typically).
  2. Right mouse click on the Firefox toolbar, and select New Bookmark.
  3. Select the Link field, and paste the link text (CTRL-V typically).
  4. Remove the underscore character from "java_script".
  5. Change the "CHANGE_THIS" in the pasted text of the bookmarklet to be your Inbox Email Address (see How to). 
  6. Change the Name field to be GMail RTM.
  7. Click Save.
To use, highlight a part of a web page, and click the GMail RTM button on your toolbar.  Make any required changes and click Send.

(The platform and browser version I used: 32-bit Firefox 15.0.1 running on 64-bit Debian Linux (Testing).)