Have you ever heard about AutoHotKey or tried to set up custom keyboard shortcuts to start applications or open files and folders in Windows?
10 Reasons Why You Should Switch From Windows To Linux
Linux has its own custom keyboard shortcut option to attach custom shortcuts to Program, File, and Folder. For windows, the story is a bit different; here, you don’t have any built-in option; instead, you have to take the help of applications like AutoHotKey.
In the future, I expect Microsoft will introduce this as a built-in feature in their operating system or at least integrate it with its powerful open-source tool PowerToys.
What is AutoHotKey
AutoHotKey (Automation HotKeys Scripting) in the name, you will get half of the answer, left we will explain. It is an open-source ultimate scripting language for windows. You can write small scripts (Ex: Keyboard Shortcuts) as you do in Linux. (Only Linux users can understand this pain)
How to Mount Windows NTFS Partition in Linux
Besides shortcut key, it’s a whole scripting language, able to create complex scripts to automate all kinds of tasks like form fillers, auto-clicking, macros, etc.
To download, browser their website, and go to the download page, two ways to use AutoHotKey in your system.
- AutoHotKey Installer: It will install the application on system level, recommeded to begineers.
- AutoHotKey Zip: Compressed file require to extract on safe place.
Both options do not require any extra steps. Once you are done, you can start writing custom keyboard shortcuts.
Without Ctrl, Shift, or Alt, shortcut keys are like life without love. Back to the topic, to specify this modifier key, you need to take the help of special syntax.
Below I have listed some helpful syntax alternatives to those modifier keys.
Create AutoHotKey Scripts
To start writing the script for shortcut keys, required to create a new file with an extension “ahk”. Two different ways to make this file.
1. Create using Context Menu
Go to the location where you want to create a script and right-click on the blank area to open the context menu of the windows file manager.
Then navigate to New -> AutoHotKey script to create a new script and rename it.
It will only be listed for the installer version. If you were using compressed zip, then follow the below method.
2. Renaming Extension
If you were using the zip version of AutoHotKey, this option would not be listed on the context menu. They need to create a custom new file and rename the extension with “ahk”.
To do so, you need to enable the show extension of unknown files from the “Folder” option.
You already did it; that’s some cool buddy is reading.
By default, “Hide extensions for known file types” will be checked; uncheck that checkbox to show the extension of all file types in your system.
Now navigate to New -> Text Document to create a new file and rename the extension from “txt” to “.ahk” in the end.
While saving the file, it may ask, “Are you sure to make changes”, click Ok.
Assign Keyboard Shortcut keys in AutoHotKey
With all in work, you can now start creating shortcut keys for Applications, Files, and Folders. You can easily open and run them with the help of shortcut keys.
Make sure to remember a few things listed below while creating the script.
- “::”: Double colon is as a separator between shortcut key and action need to perform.
- “Run”: It specify which action need to be taken after shortcut key is pressed.
Shortcut Key for Applications
Let us create a shortcut key for the common application that comes out of the box with windows. In this case, you will open a notepad using the "Ctrl+n" keyboard shortcut key.
For the "Ctrl" key, you need to use special syntax. Revisiting the top where we have already discussed a special syntax alternative to those keys. In this case, an alternative to "Ctrl" is "^", place the below code inside the script you created earlier, save and double-click it to open.
Now let us pick the google chrome browser. To open with the shortcut key, using "Alt+c" use the below script.
Shortcut Key for Files
I have created a new text file on my desktop, with the content “Hello World”. I need to show all of the content of that text document whenever I press "Ctrl+h".
In this case, you need to specify the relative location of that exact file with the file name (including extension).
<Username> with your system username.
Shortcut Key for Directories
Directory with full of images, videos, movies, or games. If you want to pop the content of those directories directly using a keyboard shortcut key, you can do that too.
In this case, I will pick the Windows directory inside C Local Disk; you can replace it with something else. The shortcut key I assign to open that directory is "Win+w".
Replace “C:\Windows” with the relative location of your directory.
Including all Applications, Files, and Folders
Instead of creating a separate “ahk” file for each of these custom shortcut keys, you can include all of them in one single file by inserting each script in a new line.
Autostart Shortcut Keys
It’s useless if your shortcut keys are not working on the next system power-up. For this, you need to place all of the script files inside the system startup folder.
To do so, open Run windows using the "Win+r" shortcut key and write
"shell:startup" to open Run windows. It will open the Startup folder; place all of your AutoHotKey script files inside this directory.
For Linux, they can easily set up shortcut keys for any application they want, can also create automation scripts using bash language. But for Windows users, things are pretty complicated for beginners.
AutoHotKey almost solves all problems specifically related to a shortcut key; in the future, if you want to know more commands or popular shortcuts of AutoHotkey, then comment down below.
Innovative tech mind with 12 years of experience working as a computer programmer, web developer, and security researcher. Capable of working with a variety of technology and software solutions, and managing databases.