I’ve been creating PowerShell scripts on my Windows PC for years, but many had to be run manually. With AutoHotkey (version 2), I’ve been able to recreate these scripts and bind them to keystrokes, making them feel like built-in Windows features Microsoft forgot to mention.
10
My Personal Quick App Launcher
Apps like Notepad, Calculator, and Paint are typically hidden from my desktop since they aren’t all that important. But from time to time, I’ve found myself hunting these apps for their quick utility. So, instead of looking through my Start menu or desktop icons, I created a custom menu that appears instantly when I press Windows Key+M using the script below.
#Requires AutoHotkey v2.0#m::{
MyMenu := Menu()
MyMenu.Add("Calculator", (*) => Run("calc.exe"))
MyMenu.Add("Sticky Notes", (*) => Run("explorer.exe shell:AppsFolder\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App"))
MyMenu.Add("Notepad", (*) => Run("notepad.exe"))
MyMenu.Add("Paint", (*) => Run("mspaint.exe"))
MyMenu.Show()
}
I’ve set mine up with Calculator, Stickynotes, MS Paint, and Notepad. However, you can easily modify the script to include your own favorites. Want to add Notion? Just duplicate one of the existing lines and change the name to “Notion,” find the .exe file for your app, copy it as a path, and insert it within the Run parenthesis.
I really like this custom menu. I just press Windows+M, click the app I want to open, and it’s done. No more scrolling through program lists or remembering where I’ve pinned that one app I rarely need. I use this several times a day now, and it saves me several little moments of friction that add up.
Holding Shift+Mouse Wheel to scroll horizontally doesn’t work with all the apps I use. Sadly, I use this action regularly, especially since I like to look at code snippets or design in CAD. So, I’ve made my own script to make horizontal scrolling work with any app that I use.
Create a script with the following to make your own version:
#Requires AutoHotkey v2.0#HotIf GetKeyState("Shift", "P")
WheelUp::Send("{WheelLeft}")
WheelDown::Send("{WheelRight}")
#HotIf
By holding Shift and scrolling my mouse wheel, I can scroll left and right instead of up or down. This works in any program that supports horizontal scrolling, from Excel spreadsheets to photo editors to web browsers with wide content.
8
Instant Access to Any Folder
I often organize my files using folders. However, sometimes, I’ve created so many subfolders that accessing a project folder takes me several mouse clicks to open. Then, I realized I could easily make a script that binds to Ctrl+ALT+D to immediately open a specified project folder.
Here’s the script:
#Requires AutoHotkey v2.0^!d::Run('explorer.exe "C:\Users\jricm\Downloads"')
You can easily modify this script by adding your folder path (with quotations) right after ‘explorer.exe.’ Of course, you can also change key bindings by using Auto Hotkey’s modifier symbols.
What I like about this approach is how customizable it becomes once you understand the pattern. I’ve created variations that open my Desktop, my Documents folder, and even specific project folders I’m working on.
7
Quick Text Expansions for Everyday Phrases
I like the idea of using Window’s alt codes to easily and quickly insert special characters. I took that same approach with an AHK script that lets me use shortcuts for common phrases I use often. Create this script to try it yourself:
#Requires AutoHotkey v2.0
#SingleInstance Force::gm::Good morning
::ty::Thank you
::brb::Be right back
With this example, whenever I type “gm” followed by a Space (or Enter), it instantly expands to “Good morning.” The same goes for “ty,” which expands to “Thank you,” and “brb” for “Be right back.” This works in any app where you can type and I find it especially helpful when I am responding to messages throughout the day.
If you want to customize it, just add your own abbreviations and phrases in the same format. It’s a small addition but adds a bit of formality to my daily communication and keeps my replies consistent. There are other ways you could insert special characters using Windows shortcuts, but I find that AutoHotkey provides the best customizability.
6
Custom Volume Control For My Keyboard
Windows volume controls have always felt awkward to me. You either click that tiny speaker icon in the system tray or hunt for the volume buttons on your keyboard, which are hard to find, especially if you work with the lights off like I do. I wanted something faster and more intuitive.
Since my fingers are always glued to the home row keys, it made sense to bind volume control with CTRL + Comma or CTRL + Period for volume control, and CTRL + M for mute and unmute. This is the script I used:
#Requires AutoHotkey v2.0
#SingleInstance Force^,::Send("{Volume_Down}") ; Ctrl + ^.::Send("{Volume_Up}") ; Ctrl + > (period)
^m::Send("{Volume_Mute}") ; Ctrl + M
I chose these combinations because they don’t conflict with common shortcuts in most programs, and they’re always within finger’s reach. When I’m on a video call, and someone’s audio is too loud, I can quickly tap Ctrl + Comma a few times without interrupting my workflow or fumbling with my mouse.
While there are several ways to set up custom volume controls on your keyboard, I prefer using AutoHotkey. It mimics the signals that dedicated volume keys send, ensuring compatibility with any audio device and all your Windows audio settings. It even has the volume overlay appear just like it would if you pressed physical volume buttons. If you prefer different key combinations, you can easily modify the script. Maybe Ctrl+Plus and Ctrl+Minus feel more natural to you, or maybe you want to use the function keys instead.
5
Centering Your Mouse Cursor Instantly
This one sounds simple, but it’s surprisingly helpful, especially if you work with a multi-monitor or a single ultrawide setup. This hotkey centers your mouse cursor when you press Ctrl+Alt+C. I originally created this for gaming, but I’ve found myself using it throughout the day. Here’s the script you need to make:
#Requires AutoHotkey v2.0
^!c:: {
WinGetPos(&x, &y, &w, &h, "A")
MouseMove(x + w/2, y + h/2)
}
The script finds the exact center point of your active window and moves the mouse there instantly. It works with any program and any window size, even if the window is partially off-screen. I use this most often when I’m switching between different applications and want to quickly focus on the new window without having to think about where my mouse ended up.
You can modify this script to center the cursor on your entire screen instead of just the active window, or create variations that move the cursor to specific positions like the top-left corner or bottom-right. Some people prefer having their cursor automatically move to the close button on Windows, which you could accomplish with a small modification to the positioning.
4
Auto-Organizing Downloads Folder
Before
After
My Downloads folder used to be chaos. Screenshots mixed with PDFs, music files next to random installers, everything just dumped into one giant pile. I tried to stay organized manually, but who has time to sort files when you’re in the middle of actually working?
This hotkey script runs in the background and automatically sorts new downloads into organized folders based on file type. I press F12 to turn it on, and every five seconds it scans your Downloads folder and moves files to appropriate subfolders. PDFs and Word documents go into a “Docs” folder, images go into “Images,” music files into “Music,” and so on. Here’s how I set it up:
#Requires AutoHotkey v2.0
downloads:="C:\Users\jricm\Downloads", interval:=5000
ext:=Map("pdf","Docs","docx","Docs","xlsx","Docs","txt","Text","jpg","Images","png","Images","mp3","Music","mp4","Videos","exe","Programs","zip","Archives")
F12:: {
static on:=false
on:=!on, SetTimer(MoveFiles, on?interval:0)
ToolTip("AutoSort: " (on?"ON":"OFF")), SetTimer(() => ToolTip(), -1500)
}
MoveFiles() {
Loop Files downloads "\*.*", "F"
if ext.Has(e:=A_LoopFileExt) {
d:=downloads "\" ext[e]
if !DirExist(d)
DirCreate(d)
try FileMove(A_LoopFilePath, d "\" A_LoopFileName, 1)
}
}
The script creates these folders automatically if they don’t exist, so you don’t need to set anything up beforehand. It’s smart enough to handle file conflicts too. If you download two files with the same name, it won’t overwrite the existing one.
If you also want to use the script I’ve provided, you’ll first have to change the folder path beside the “downloads” variable. You can also change and add other file extensions by appending the extension type to the “ext” variable.
There’s a small tooltip that appears when you toggle it on or off, but otherwise it just quietly does its job in the background. The five-second interval means it catches new downloads quickly without constantly scanning and slowing down your computer.
3
Launching Multiple Apps for Specific Workflows
I love using Window’s Virtual Desktops to organize various tasks. It’s a shame it doesn’t allow you to auto-open certain apps or change apps per virtual desktop. As a remedy, I’ve used AutoHotkey to open multiple apps with a single keystroke. Here’s the script I use:
#Requires AutoHotkey v2.0+1:: {
Run('"C:\Users\jricm\AppData\Local\Programs\Microsoft VS Code\Code.exe"')
Run('"C:\Program Files\JetBrains\DataGrip 2023.3.4\bin\datagrip64.exe"')
Run('"C:\Program Files\Docker\Docker\Docker Desktop.exe"')
}
By pressing Shift+1, the script launches Visual Studio Code, DataGrip, and Docker applications simultaneously. These apps like to take their time when loading (even without the script), so it’s the perfect opportunity to get my coffee or organize my workspace. By the time I’m ready to work, all three programs are open and ready to go. This saves me the mental overhead of remembering which programs I need for certain projects, and the time spent clicking through to launch each one.
I’ve created several variations of this script for different types of work. Shift+2 launches my writing setup with Notion, Google, and Asana. Shift+3 opens my 3D design setup, which includes Fusion 360, Creality Print, and YouTube Music. Having these one-key workflow launchers eliminates the friction of getting started on different types of projects.
2
Keeping Important Windows Always Visible
There are plenty of times when I want a window to stay visible, like when I am following a tutorial, checking notes, or chatting with people. Windows does not give you an easy way to do this. So, I’ve created a script for this specific purpose.
#Requires AutoHotkey v2.0ScrollLock:: {
try {
activeHwnd := WinGetID("A")
isTopMost := WinGetExStyle(activeHwnd) & 0x8 ; 0x8 = WS_EX_TOPMOSTWinSetAlwaysOnTop(!isTopMost, activeHwnd)
SetScrollLockState(isTopMost ? "Off" : "On")ToolTip("Always On Top: " (isTopMost ? "OFF" : "ON"))
SetTimer(() => ToolTip(), -1000)
}
}
With the script above, I can simply tap the Scroll Lock key while my window is active, and it stays on top of everything else. The script gives me a quick tooltip and turns the Scroll Lock light on my keyboard on or off, so I always know what is pinned. I use this trick all the time when I need a reference window handy without having to keep moving things around or switching back and forth. Scroll Lock is a good choice since most people do not use it for anything else, but you can change it to another key if you want.
1
Preventing Your Computer from Sleeping
I sometimes download and transfer larger files on my computer. The whole process can take several minutes to a couple of hours. My problem was that my downloads often get interrupted due to my PC sleeping after a few minutes. This always frustrates me as trying to retry or resume a download often fails. To solve the problem, I’ve created a script that binds to my Ctrl+Alt+Shift+S keys to effectively bypass my computer’s sleep system.
#Requires AutoHotkey v2.0
#SingleInstance Forceglobal on := false, endTime := 0
^!+s::{
global on, endTime
if !on {
hrs := InputBox("Enter hours (0 = infinite):", "Anti-Sleep").Value
if !IsNumber(hrs) || hrs return MsgBox("Invalid input.")
endTime := hrs ? A_TickCount + hrs*3600000 : 0
SetTimer(AntiSleep, 300000), SetTimer(CheckEnd, 1000), on := true
ToolTip("Anti-Sleep: ON" (hrs ? "`n" hrs "h" : ""), 500, 500), SetTimer(() => ToolTip(), -1500)
} else { ; Required braces for multi-line else block
SetTimer(AntiSleep, 0), SetTimer(CheckEnd, 0), on := false
ToolTip("Anti-Sleep: OFF", 500, 500), SetTimer(() => ToolTip(), -1000)
}
}AntiSleep() => (MouseMove(1,0,0,"R"), MouseMove(-1,0,0,"R"))
CheckEnd() => endTime && A_TickCount >= endTime && Send("^!+s")
^!+x::Send("^!+s")
The script works by moving the mouse a little bit every five minutes. This way, my PC doesn’t go idle and sleep. I’ve also recently expanded the script to also include a timer to deactivate the script after a certain time has passed. The script also shows a small tooltip when you activate or deactivate it, so you always know whether it’s running.
AutoHotkey might seem intimidating at first, but you don’t need to understand every line of code to benefit from it. Download AutoHotkey and start with one or two scripts that solve problems you actually have. Once you’re comfortable with how they work, gradually add more as you discover new ways to improve your workflow.
Leave a Comment
Your email address will not be published. Required fields are marked *