Open a website

with AutoHotkey

by Denis Lamarre
last updated May 30, 2014
difficulty.png Easy

by Denis Lamarre

Description

If you find yourself opening a browser and then a search engine to find a website, or you visit the same website many times daily, then a one-click solution to bring up that website would come in handy. 

This script will allow you to access the websites you frequent most without having to minimize or move windows out of your way and without disturbing your workflow.

A one-click connection to your most used websites makes it easier to close unused browser tabs knowing that accessing the site again is a breeze.  Fewer open windows means less demand on memory and a cleaner desktop.

Note: AutoHotkey has no limits when it comes to automation in Windows, but for many users who may only need simple keyboard shortcuts, installing and learning AutoHotkey, and keeping up to date, can be overkill. ShortKeeper can be used (with and without an Enterpad) to manage an AutoHotkey-based system in a way most non-programmers will find remarkably user-friendly and and effective [learn more].

Steps

1

stencil-v4-website.gifPrepare your overlay.
Choose a free key on the Enterpad for which you want to open a frequently-used website. Name it something relevant, like the website's name.

2

Code installation.
Copy/paste the following script in your AutoHotkey script template (Enterpad.ahk) at the chosen key location. Replace our sample URL (www.google.com) with your choice. (You can copy/paste the entire web address from the address bar at the top of your browser window)

001:
run www.google.com
return

More Info

A URL is the address you need to type into your browser to reach a website. http://www.google.com and http://www.yahoo.com are examples of URLs.

As URLs are intended to work worldwide, regardless of the computer or user language, some special characters need to be encoded. For instance, a space has to be encoded as '%20' in a URL.

So, with these special characters, copying URLs may not be as easy as copy-and-paste in certain cases. If, for instance, a URL you want contains encoded characters, copying it as it is in the script next to the Run command and as illustrated next will not work in AutoHotkey:

run http://en.wikipedia.org/wiki/Overlay%20keyboard

Why? Because the percent sign is a special character that AutoHotkey uses to identify variables. Therefore, you will have to add a backtick ( ` ) before any percent sign (%) you find. The previous script will become:

run http://en.wikipedia.org/wiki/Overlay`%20keyboard

Also, the backtick ( ` ) is another special character used for AutoHotkey. So two special characters are to be converted: ( ` ) and (%).

You may want to use the following script (and maybe save it as a key on your Enterpad) to automatically convert the content of the clipboard (hopefully a URL) and paste it somewhere in your AHK script.

AhkFriendlyURL = %clipboard%
StringReplace AhkFriendlyURL, AhkFriendlyURL, ``, ````, All
StringReplace AhkFriendlyURL, AhkFriendlyURL, `%, ```%, All
SendInput {raw}%AhkFriendlyURL%
return

The first line of this script copies the clipboard content to a variable. So, this script won't modify the clipboard content. The use of {raw} in the fourth line is necessary to restore the AhkFriendlyURL variable without translating {Enter} to an ENTER, ^c to a Control-C and so on.