Open a website

with AutoHotkey

by Denis Lamarre
last updated March 11, 2019
difficulty.png easy

Description

If you visit the same website often, why not use a keyboard shortcut to access it quickly? A keyboard shortcut will also mean not having to keep unnecessary browser tabs open, and fewer open tabs means less demand on your computer’s memory. This script lets you use a keyboard shortcut to access your favorite website.

Steps

1

stencil-v4-website.gifPrepare your overlay
Choose an unassigned key on the Enterpad where you will assign the shortcut. Name it something appropriate, like the name of the website.

2

Code installation
Copy and paste the script below in the AutoHotkey script template (Enterpad.ahk) at the location of the key you wish to assign. Replace the URL in the code (here, "www.google.com") with that of your choice. (You can copy and paste the URL from the address bar at the top of your browser window.)

001:
run www.google.com
return

More Info

A URL is the address for a given website, for example: www.google.com and www.yahoo.com. URL stands for "Uniform Resource Locator".

Since URLs need to work across computing platforms and across the world, some special characters need to be encoded. For instance, a space is encoded as "%20" in a URL.

Due to these special characters, however, URLs occasionally present issues with AutoHotkey. If, for instance, a URL contains encoded characters, typing it in as is in the script next to the Run command (as shown here) 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 a variable. Therefore, in AutoHotkey you will need to add a backtick ( ` ) before any percent sign ( % ) in a URL. The script will become:

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

As you may have guessed, the backtick ( ` ) is another special character used in AutoHotkey. If a URL contains a backtick, you will need to add a backtick in front of it too.

To make things easier, you may want to use the following script to automatically convert a URL that has been copied to your Windows clipboard. It will also insert the converted URL in your AHK script (wherever your cursor happens to be).

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