How to Launch a Bookmarklet with a Keyboard Shortcut

In keeping with my recent theme of keyboard shortcuts, this post will show you how to launch any bookmarklet you want with a keyboard shortcut. At first I searched high and low for a Firefox extension that would help with this. The closest one I found is called Devo. It’s a command launcher for Firefox, similar to Launchy or Quicksilver. However, it’s still experimental and requires a login to even download it. I opted not to try it out because of the hassle and potential instability at this stage.

My solution isn’t great, but it’s the best I’ve found. It’s to use AutoHotkey to manually launch the bookmarklet.

The main reason I wanted this functionality is because I bookmark all sorts of sites on delicious with their bookmarklet, but I have to take my hands off the keyboard and use the mouse to do it. Now I can just hit a few keys, type in some tags and be done.

Here’s my example shortcut:

^!9::
  Send ^l
  SendInput {Raw} (Paste the contents of the bookmarklet here)
  SendInput {Enter}
return

The first line makes the shortcut Control-Alt-9. The next line puts the cursor in the Firefox URL bar. The third line types the link of the bookmarklet into the URL bar. The last line hits enter, submitting the bookmarklet.

SendInput is the fastest way to send data, but it still takes a long time to enter the text. This is far from a perfect solution, but until I find a better one this gets the job done.

Comments are closed