Custom Keyboard Shortcut on Windows OS with AutoHotkey: Unlock Your Productivity Potential
In this blog, we’ll explore the powerful world of AutoHotkey, a versatile scripting language that allows you to automate repetitive tasks and enhance your productivity on Windows OS. To start, we’ll create a simple script that allows you to establish custom keyboard shortcuts.
Consider a common use case: you want to streamline your workflow by quickly accessing your favorite website using a keyboard shortcut. This can significantly enhance efficiency by reducing the time spent navigating through your browser. To accomplish this, we can utilize AutoHotkey to create a straightforward script that assigns a specific keyboard combination to open the desired URL. Below is a basic example of how to implement this functionality.
; filename: customkeys.ahk
; open the home website when you press Alt + ~
!~::
Run, https://tessarinseve.pythonanywhere.com
return
First, you need to install AutoHotkey. Once you have it installed, the next step is to save the script above. For instance, you can create a file named customkeys.ahk where you will store the code that defines your hotkeys.
|
After saving the script, you can run it by simply double-clicking the file in your file explorer. This action will activate the script, and you should see a green H icon appear in your system tray, indicating that AutoHotkey is running.
In this case, pressing the Alt key along with the tilde key will allows you to quickly access your intended website without having to navigate through bookmarks or type the URL manually.
Another useful keyboard shortcut is to use CtrlM to minimize the active window. This simple combination allows me to quickly hide the current window without having to reach for the mouse or navigate through the taskbar.
; filename: customkeys.ahk
^m:: ; Ctrl + m to minimize window
WinMinimize, A
return
Shown below is the AutoHotkey script that fits neatly with my workflow and facilitates window management through a series of keystroke combinations.
This script allows me to quickly arrange open windows by holding the Ctrl, Alt, and Windows keys while pressing one of the keys surrounding the K key. For instance, the combination Ctrl+Alt+Windows+J repositions the active window to the left half of the screen.
Keyboard Shortcut Management
We recommend utilizing our dedicated sheet (available for both Mac and PC) to document keyboard shortcuts, allowing you to record both custom and default definitions. By supporting my work with a virtual cup of coffee, you will gain access to these comprehensive sheets at the link below.
https://buymeacoffee.com/seve/keyboard-shortcut-sheet
AutoHotkey version 2
AutoHotkey's user base is largely split between version 1 and version 2. Many users continue to favor version 1 due to its long-standing presence, extensive library of scripts, and community support. The familiarity and established resources make it a comfortable choice for those who have been using it for years, leading to a slower transition to the newer version.
AutoHotkey version 2 was introduced to simplify the language and improve usability with a more consistent syntax, but this shift has posed challenges.
Below is a table that explains the meaning of common AutoHotkey string symbols used for keyboard shortcuts:
Symbol | Key Modifier | Description |
^ | Ctrl | Control key |
! | Alt | Alt key |
+ | Shift | Shift key |
# | Win | Windows key |
:: | Hotkey Definition | Indicates the start of a hotkey definition |