Saturday, March 11, 2017
AutoHotkey: Reprogramming Your Keyboard
By Russell Miles
As technology becomes increasingly customizable, the traditional computer keyboard remains surprisingly restrictive. Keys cannot be easily rearranged, and useful functions are often hidden behind long strings of keys that are difficult to remember. However, this can all be changed with AutoHotkey: a free and easy-to-learn software that allows you to reprogram your computer keyboard in any way imaginable.
After downloading AutoHotkey, the easiest way to create a new script is to right-click on your desktop. Mouse over the "New" menu and select "AutoHotkey Script."
Right-click your new file to select "Edit script" and you are ready to go!
A finished script can be activated by double-clicking it on the desktop, or right-clicking and selecting "Run script." When you are done using your script, navigate to the taskbar to find the green "H," right-click, and select "exit."
Here are just a few things that you can accomplish using this program:
1) Experiment with new keyboard layouts.
Everyone is familiar with the classic QWERTY keyboard, but some people believe that other keyboard layouts are faster or more efficient. Autohotkey allows you to make changes as simple as switching two keys, or as complicated as rearranging your entire keyboard.
To create a new hotkey, enter the key you want to replace followed by two colons (::). After the colons, enter the key's new function. Here is a script that replaces the "Q" key with the "A" key:
Simple, right? Now you can proceed to make any changes you want. This script replaces the QWERTY layout with one that puts all keys in alphabetical order.
Once you have rearranged your keyboard, save your script through the "File" menu just as you would with a Word document. Remember that you have to activate your script to get it to work.
2) Manipulate the mouse.
Placing mouse functions on other keys can make your laptop more comfortable to use during long Internet-surfing sessions. The "WheelUp," WheelDown," "WheelLeft," and "WheelRight" functions allow you to scroll up, down, left and right. "LButton" and "RButton" refer to the mouse buttons. This script allows you to scroll up and down, as well as left- and right-click, with the top four buttons of the keyboard.
You can also experiment with MouseMove, MouseClickDrag, and several other functions for more advanced mouse operations.
3) Replace misspelled words using Hotstrings.
Sometimes, the spell-check in Microsoft Word or Google Docs just doesn't cut it. It's annoying to drag your mouse back to fix a squiggly red line after every typo. By using hotstrings, you can replace a string of keys with other functions. Instead of the single pair of colons following hotkeys, hotstrings are surrounded by two pairs of colons.
While this script is running, "omw" will be replaced with with "on my way." Capitalization is preserved, so "Omw" will give you "On my way" instead. Now you can add a personalized version of your smartphone's autocorrect to your computer.
I used my own autocorrect script while writing this post. With hotstrings, you'll never have to deal with these annoying typos again!
4) Activate a string of keys using a single command.
Here's where things can get really interesting. The "Send" functions allow you to program a hotkey to input a long series of keys. Try out this script that programs the "0" key to type a message:
Most keys can be activated in this way, but some require special codes. If you want to use this
function to press other keys like "Shift," "Alt," "Enter," or "Ctrl," you will have to put them in brackets.
This script holds down and releases the "Alt" and "F4" keys to replicate Alt+F4, a function that closes your current program. If you don't want to give up one of your keys to perform this function, you can create a function of your own.
Now, pressing Alt+X will function exactly the same as Alt+F4. The exclamation point is a code for "Alt" when used in a hotkey. Check the links at the end of this post for other codes.
5) Use custom functions to run programs.
If you want to go beyond the limits of Ctrl+C, Ctrl-V, Alt+Tab, and all the other familiar keyboard functions, you can use AutoHotkey to make your own. The "Run" function allows you to set hotkeys to run a variety of files.
Simply type "run," after a hotkey, then enter the name of a file on your computer. This script sets Alt+T to run Task Manager, Alt+C to run the Calculator app, Alt+N to run the Notepad, Alt+M to run Windows Media Player, Alt+G to run Google, and Alt+S to run the Snipping Tool. Notice that a select few websites, including Google, can be opened using the Run function. Alt+S helped me quickly capture screenshots of my scripts for this post.
These are just a few of the things you can accomplish with AutoHotkey, but the possibilities are endless. AutoHotkey's online database is extremely useful, as it has pages for every function. If you are interested in experimenting with AutoHotkey, read the useful tutorials here and here for more information.