Welcome!  English (US) Language Switcher

Bookmarklets for Turning URL of Current Page into RTM Task

wcitypoe says:

This is a bookmarklet you can use to create a task based on the webpage you're currently visiting. Thanks to the forum's filters, please replace the "#" with the word "javascript" followed by a colon; also, replace the "list=999999" with whatever the ID number of your destination list is (you can determine this via the Print button).

#popw='';name='';priority='';due='';repeat='';estimate='';tags='';url='';add='';x=document;y=window;if(x.selection){name=x.selection.createRange().text;}else if (y.getSelection){name=y.getSelection();}else if (x.getSelection){name=x.getSelection();}var name = prompt("Describe the task to do.", "");var priority = prompt("Priority? 1-3, 4 for normal.", "");var due = prompt("When does this need to be done by?", "");var repeat = prompt("How often does this repeat? Hit Return if one-time.", "");var estimate = prompt("How long will this take you? Hit Return to ignore.", "");var tags = prompt("What tags to assign?", "");var add = "\"Add Task\"";popw = y.open('http://m.rememberthemilk.com/add?name=' + escape(name) + '&list=999999&priority=' + escape(priority) + '&due=' + escape(due) + '&repeat=' + escape(repeat) + '&estimate=' + escape(estimate) + '&tags=' + escape(tags) + '&url=' + escape(location.href) + '&add=' + escape(add),'taskForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout('popw.focus()',50);void(0);

Alternatively, here is a speed version that will not prompt you at all. It uses the page's title as the text of the task, assigns it a low priority (you could replace the 3 with a 4 for no priority), gives you a due date of tomorrow, no repeat or estimate values, and a "@url" tag, and of course, as with the above bookmarklet, attaches the page URL to the task. If you find you need something more exotic, it should be easy to figure out what you need to substitute. Same deal with the "#" as above.

#popw=window.open('http://m.rememberthemilk.com/add?name=' + escape(document.title) + '&list=730842&priority=3&due=tomorrow&repeat=&estimate&tags=' + escape('@url') + '&url=' + escape(location.href) + '&add=' + escape('\"Add Form\"'), 'taskForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout('popw.focus()',50);void(0);

Posted at 6:48am on November 17, 2007

wcitypoe says:

A slight improvement -- the first of the two bookmarklets above, as posted, didn't take advantage of the "if text is selected, use it" code, but this version would.

#popw='';name='';priority='';due='';repeat='';estimate='';tags='';url='';add='';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();}var sel = prompt("Describe the task to do.", sel);var priority = prompt("Priority? 1-3, 4 for normal.", "");var due = prompt("When does this need to be done by?", "");var repeat = prompt("How often does this repeat? Hit Return if one-time.", "");var estimate = prompt("How long will this take you? Hit Return to ignore.", "");var tags = prompt("What tags to assign?", "");var add = "\"Add Task\"";popw = y.open('http://m.rememberthemilk.com/add?name=' + escape(name) + '&list=999999&priority=' + escape(priority) + '&due=' + escape(due) + '&repeat=' + escape(repeat) + '&estimate=' + escape(estimate) + '&tags=' + escape(tags) + '&url=' + escape(location.href) + '&add=' + escape(add),'taskForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout('popw.focus()',50);void(0);

Posted 6 years ago

wcitypoe says:

Drat. Goofed up on this newest version. Second line, it says "var sel =". Replace that with "var name =". Sorry.

Posted 6 years ago

raymond.bergmark ProPower Poster says:

I deleted parts of your javascript to create a bookmark that:
1 Don't prompt you at all
2 Takes the selected text as the task name
3 Adds a duration of 15 min
4 Adds the URL from the current page
5 Not yet any tags, will work on that. If you delete the Add=+escape(add)-part at the end, you will be able to edit the task before adding it, allowing you to add the tags you want.
6 If you want to edit the defaults, do this in the beginning where the variables are declared (priority='1' for instance)

#popw='';name='';priority='';due='';repeat='';estimate='15 min';tags='';url='';add='';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();}var name = sel;var add = "\"Add Task\"";popw = y.open('http://m.rememberthemilk.com/add?name=' + escape(sel) + '&list=9999999&priority=' + escape(priority) + '&due=' + escape(due) + '&repeat=' + escape(repeat) + '&estimate=' + escape(estimate) + '&location=99999&tags=' + escape(tags) + '&url=' + escape(location.href) + '&add=' + escape(add),'taskForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout('popw.focus()',50);void(0);

As above, replace # with javascript and a colon. You also need to replace list=9999999 with your default list (look at the print link) and also location=99999 with your location (@work?) which can be found by looking at the source code at http://m.rememberthemilk.com/add

Posted 6 years ago

davebc says:

Trying to use the first bookmark because I want control when I create it. But I don't quite get how to grab the ID number of my destination list. How exactly do you do via the Print button? Is there another method?

Posted 6 years ago

davebc says:

Nevermind, just figured it out

Posted 6 years ago

davebc says:

Ok I've made the javascript and var name adjustments when trying to get wcitypoe's bookmarklet to work, but neither Firefox nor Safari on a Mac like the bookmarklet. I've also adjusted the list number I'm sending the task to.

Simply nothing happens. Any ideas?

Posted 6 years ago

wcitypoe says:

Dcharti, copy the URL and paste it into an e-mail ... send it to windySPAMcitySPAMpoeATgSPAMmail.com. Remove the SPAMs and replace AT with @. Let me see if I can figure out what's going on.

Posted 6 years ago

jimjoh says:

rajjan, I edited your javascript to create one that sets the due date to today with no duration. The biggest change is how the task name is set. The task name is "url SELECTEDTEXT" if you have selected text, otherwise it's set to "url PAGETITLE". That way I can easily and quickly choose between creating a task name based on my selection or the page title. I prepend "url " to the beginning of the task name so that it's easy for me to spot my "url tasks".

In my first draft when grabbing the page title I used "escape(document.title)" since everyone is escaping everything here. I noticed that this caused my task names to have ugly names like "Title%20With%20Spaces". To get friendlier looking titles I removed the escape funtion so I now just make a naked "document.title" call. How dangerous is this? I'm guessing that the escape function is used for a reason, like to protect some funky character from killing the script. However I've tested my escapeless javascript with all of these special characters " "'!@#$%^&*()[]{}/\|?,.:; " and they all worked fine. If the worst case of not escaping the document title is that my bookmark simply doesn't work on rare cases (for really exotic characters) I'm ok with that. Seeing "%20" instead of spaces in my task names is just too ugly for me.

The only other issue I have is that the popup window doesn't always get focus. I can't determine the cause, but sometimes it falls back behind my main browser window. Is there a fix for this? I use Firefox 2.0.0.11.

My javascript is below:

#popw='';name='';priority='';due='today';repeat='';estimate='';tags='';url='';add='';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 != ""){name = "url " + sel;}else{name = "url " + document.title;}var add = "\"Add Task\"";popw = y.open('http://m.rememberthemilk.com/add?name=' + escape(name) + '&list=99999&priority=' + escape(priority) + '&due=' + escape(due) + '&repeat=' + escape(repeat) + '&estimate=' + escape(estimate) + '&location=99999&tags=' + escape(tags) + '&url=' + escape(location.href) + '&add=' + escape(add),'taskForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout('popw.focus()',50);void(0);

As above, replace # with javascript and a colon. You also need to replace list=9999999 location=99999.

Thanks rajjan and wcitypoe for sharing your javascript. I would've never been able to figure this out being able to "borrow" your code.

Posted 6 years ago

Log in to post a reply.