Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Enterprise
Expertise: Beginner
Apr 19, 2007



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Use AutoHotKey to Write a JavaScript Bookmarklet to the Browser Window

To make a hotkey that does something complicated in the browser you will probably need to send a JavaScript bookmarklet to the browser address bar. For example, suppose you wanted a hotkey that sent the current page as a bookmark to del.icio.us. You'd do something like this:

Send !d 
Send javascript:location.href=
The above code re-maps the combination of the control key (^) and the d to send alt-d (the ! in AutoHotKey is a shortcut for alt) followed by a JavaScript URL which sends the current location.href to del.icio.us (this assumes, of course, that you've got a del.icio.us account and are logged in).

The {t} and the {Enter} will send the + key and the Enter key respectively, the curly brackets are used as escapes in AutoHotKey, and the + sign is generally used as a shortcut for the shift key.

Obviously, you could make variations in the hotkeys by mapping a key combination to send a JavaScript passing Del.icio.us the address of the current page and mapping another key combination to pass the domain of the current page. For example:

Send !d 
Send javascript:location.href='http://del.icio.us/post?v=4;url='{+}encodeURIComponent('http://'{+}

Click here for a more in-depth discussion of hotkeys that send JavaScript.

Bryan Rasmussen
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date