14 AutoHotkey scripts you can use every day
Every second you spend performing mundane, redundant tasks on your screen adds up to hours of your life wasted on unavoidable repetition. These AutoHotkey scripts will reclaim that time and transform the way you interact with your PC.
1. Quickly search any selected text on Google
If you're new to AutoHotkey, it's a powerful scripting language for automating repetitive tasks in Windows. With just a few lines of code, you can streamline everyday actions—like searching the web with a single keystroke.
This first script allows you to highlight any text, press Ctrl + Shift + S and a new tab will automatically open with Google search results for your selection. No need to open a browser, type in the search bar and press Enter , this script does it all in one go.
#Requires AutoHotkey v2.0 ^+s:: { Clipboard := "" Send("^c") ClipWait() Run "https://www.google.com" WinWaitActive "Google - Google Chrome" ; Adjust window title as needed Sleep 500 Send("^v") Sleep 100 Send("{Enter}") }
Perfect for quick research, checking terminology, or looking up references without losing motivation. It's like having a research assistant living in your clipboard.
2. Kill any frozen application without Task Manager
When an application is locked or refuses to quit, Ctrl + Alt + K will kill it without any further steps. It closes the active window without asking any questions. That means you can get back to what's important in seconds.
#Requires AutoHotkey v2.0 ^!k:: { pid := WinGetPID("A") if (pid) { procName := "" for proc in ComObjGet("winmgmts:").ExecQuery("SELECT Name, ProcessId FROM Win32_Process WHERE ProcessId = " pid) { procName := proc.Name } if (procName != "explorer.exe") { Run('taskkill /PID ' . pid . ' /F', "", "Hide") } else { MsgBox("Cannot kill explorer.exe! Killing this will crash your taskbar.") } } }
This script will save you from frozen screens, looping video players, and even Photoshop when it crashes. Remember that there are also some hidden Windows tricks to close applications immediately , which are worth exploring.
3. Mute the system immediately
Each keyboard seems to have a different key combination to mute. Downloading this script to each device would create a universal solution to a common annoying problem.
#Requires AutoHotkey v2.0 ^!m:: ; Ctrl+Alt+M to toggle mute { Send("{Volume_Mute}") }
Whether someone calls unexpectedly or you open a noisy website in a quiet room, this shortcut puts you in control instantly. Ctrl + Alt + M will turn your system volume on or off. No more fumbling with media keys on your keyboard, no distractions, just silence when you need it most.
4. Remap the Caps Lock key to Ctrl (without losing the Caps Lock key)
If you constantly use Ctrl shortcuts like copy, paste, undo, select all, your pinky will thank you for this script. This script makes the Caps Lock key act like the Ctrl key, which is much more convenient, especially if you're on the left side of the keyboard all day.
#Requires AutoHotkey v2.0 SetCapsLockState("AlwaysOff") CapsLock:: { Send("{Ctrl down}") KeyWait("CapsLock") Send("{Ctrl up}") } +CapsLock:: SetCapsLockState("Toggle")
Don't worry, you haven't lost your Caps Lock key. This script remaps the Caps Lock toggle function to Ctrl + Caps , should you need it for any reason. In everyday use, this makes pressing Ctrl faster and more comfortable than ever.
This script can also be applied to any awkwardly placed keys on the keyboard. Just swap the keys in the script itself and replace them with any other keys that are hard to reach.
5. Launch most used apps with a key combination
If you've been ignoring Notepad, it's time to reconsider. Whether you're jotting down ideas, writing temporary code, or deleting text before it's lost, Notepad is the way to go for speed and simplicity.
#Requires AutoHotkey v2.0 ^!n:: Run("notepad.exe")
With this key combination, Ctrl + Alt + N will launch Notepad instantly. You can swap between any application: Calculator, Word, Outlook , any application you choose. It allows you to save time by completely cutting out the Start menu and search bar.
6. Open favorite folder
With just one keystroke, you can open your Documents folder or any folder you trust. Whether it's a project repository, downloads, or a client repository, you don't have to click around like it's 2009.
#Requires AutoHotkey v2.0 userProfile := EnvGet("USERPROFILE") ^!d:: Run(userProfile "Documents") ^!p:: Run(userProfile "Pictures") ^!v:: Run(userProfile "Videos")
For example, you can map Ctrl + Alt + D to Documents, Ctrl + Alt + P to Pictures, and Ctrl + Alt + V to the Videos folder. The muscle memory is very basic, so you barely have to think about what you're doing.
7. Toggle hidden files in File Explorer
There are many ways to hide files or folders in Windows, but how easy is it to make them visible again? This script toggles the visibility of hidden files without having to go into File Explorer settings or go through 4 deep menus. It even automatically restarts Explorer to apply the change.
#Requires AutoHotkey v2.0 ^!h:: { toggleHiddenFiles() } toggleHiddenFiles() { psCmd := " ( $key = 'HKCU:SoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced' $val = Get-ItemProperty -Path $key -Name Hidden if ($val.Hidden -eq 1) { Set-ItemProperty -Path $key -Name Hidden -Value 2 } else { Set-ItemProperty -Path $key -Name Hidden -Value 1 } (New-Object -ComObject Shell.Application).Windows() | ForEach-Object { $_.Refresh() } )" RunWait("powershell -Command " . Chr(34) . psCmd . Chr(34), "", "Hide") }
Ctrl + Alt + H . That's it! You can see .git, .env, and any other sneaky files instantly. Essential for developers, system administrators, and anyone working incognito.
8. Paste the email address immediately
This is so simple—and so useful—that it almost feels like cheating. Whenever you fill out a form, log into a new device, or sign up for an unknown service, typing '@@' will instantly paste your email address.
#Requires AutoHotkey v2.0 ::@@::your.email@example.com
You can also set up your own variations, like '@@w' for work or '@@p' for personal. It's a small shortcut, but it adds up quickly. One less thing you'll have to type 50 times a week.
9. Paste email template or quick text
You can use this to sign emails, bug reports, even pre-written tutorial responses. You can insert line breaks with {Enter} and format as you like.
#Requires AutoHotkey v2.0 ::sig::Best regards,{Enter}Your Name{Enter}your.email@example.com
As you start automating these small interactions, you'll realize how repetitive you often are. Eliminate it from your day and you'll feel the difference.
10. Stamp date and time wherever you type
Ever type meeting notes, journal entries, or change logs and have to stop to check the time? This script makes that obsolete. Type "ts" and the full date/time stamp will appear, formatted exactly how you like it.
#Requires AutoHotkey v2.0 ::ts:: { ; Get the current time components hour12 := A_Hour ampm := "am" if (hour12 = 0) { hour12 := 12 ampm := "am" } else if (hour12 >= 12) { if (hour12 > 12) hour12 -= 12 ampm := "pm" } FormatTime := Format("{:02}/{:02}/{} {:d}:{:02}{}", A_MM, A_DD, A_YYYY, hour12, A_Min, ampm) Send(FormatTime) Return }
One major benefit of this simple script is that timestamping increases data security in digital systems. You have the option to edit the date format to DD/MM/YYY or change the clock to 24-hour, if that makes sense for your workflow. Fast, silent, and perfect for anyone who has to take notes while working.
11. Automatically corrects most common typing errors
Browsers and Word already have autocorrect features, but they don't work in every app. They almost certainly don't work in obscure tools or internal consoles. This script works system-wide. You can access the autocorrect script here .
This is the top of all the scripts and will likely continue to grow as you realize how often you mistype words on the keyboard. You can easily open this script to expand your own list of typos. If you are a fast but sometimes sloppy typist, this script is like having someone to help you keep track of your spelling.
12. Smart window resizing tool for increased productivity when split screen
This tool is like Windows' native screenshot feature, but with instant precision. Ctrl + Alt + Left Arrow will resize your current window to the left half of the screen, while Ctrl + Alt + Right Arrow will snap the window to the right half. No dragging and no struggling to get the perfect alignment.
#Requires AutoHotkey v2.0 ^!Left::SnapHalf("left") ^!Right::SnapHalf("right") SnapHalf(side) { hwnd := WinGetID("A") if !hwnd { MsgBox("No active window.") return } try WinRestore(hwnd) Sleep(100) if !WinExist("ahk_id " hwnd) { MsgBox("Window no longer exists.") return } MonitorGetWorkArea(1, &left, &top, &right, &bottom) width := right - left height := bottom - top if (side = "left") { x := left } else if (side = "right") { x := left + width // 2 } else { MsgBox("Invalid side.") return } ; Use MoveWindow API instead of WinMove for better compatibility success := DllCall("MoveWindow" , "Ptr", hwnd , "Int", x , "Int", top , "Int", width // 2 , "Int", height , "Int", true) if !success { MsgBox("MoveWindow API failed. Window may not support repositioning.") } }
It's a lifesaver for dual-monitor work, side-by-side editing, or filling in referenced information in a spreadsheet. Use it once and you'll never have to manually resize a window again.
13. Move active window to next monitor
If you work with dual monitors (or more), window management is always a bit of a battle. This script isn't fancy - it simply moves the current window to the next monitor instantly.
#Requires AutoHotkey v2.0 ^+w::MoveWindowToNextMonitor() MoveWindowToNextMonitor() { hwnd := WinGetID("A") if !hwnd { MsgBox("No active window found.") return } ; Get current window position WinGetPos(&wx, &wy, &ww, &wh, hwnd) monitorCount := MonitorGetCount() if (monitorCount ; Only one monitor: just maximize the window on current monitor WinMaximize(hwnd) return } ; Find which monitor the window is mostly on (center point) centerX := wx + ww // 2 centerY := wy + wh // 2 curMonitor := GetMonitorFromPoint(centerX, centerY) nextMonitor := curMonitor + 1 if (nextMonitor > monitorCount) nextMonitor := 1 ; Get work area of the next monitor MonitorGetWorkArea(nextMonitor, &left, &top, &right, &bottom) width := right - left height := bottom - top ; Move and resize the window fullscreen on the next monitor success := DllCall("MoveWindow" , "Ptr", hwnd , "Int", left , "Int", top , "Int", width , "Int", height , "Int", true) if !success { MsgBox("Failed to move window to monitor " . nextMonitor) } } GetMonitorFromPoint(x, y) { MONITOR_DEFAULTTONEAREST := 2 hMon := DllCall("MonitorFromPoint", "Int", x, "Int", y, "UInt", MONITOR_DEFAULTTONEAREST, "Ptr") return MonitorIndexFromHandle(hMon) } MonitorIndexFromHandle(hMonitor) { count := MonitorGetCount() Loop count { MonitorGet(A_Index, &l, &t, &r, &b) midX := l + (r - l) // 2 midY := t + (b - t) // 2 h := DllCall("MonitorFromPoint", "Int", midX, "Int", midY, "UInt", 2, "Ptr") if (h = hMonitor) return A_Index } return 1 }
This complex script makes dragging windows obsolete. To get the most out of it, check out this article on setting up dual monitors .
14. Convert selected text to sentence case
This script solves a surprisingly common annoyance—when you copy text in all caps or inconsistent structure and want to write it down in a usable format. Just hit Ctrl + Alt + C , and anything you've highlighted will instantly be converted to sentence case: The first letter is capitalized, everything else is lowercase.
#Requires AutoHotkey v2.0 ^!c:: ; Ctrl + Alt + C { ClipSaved := ClipboardAll() ; Backup clipboard A_Clipboard := "" ; Clear clipboard for fresh copy Send("^c") ; Copy selected text if !ClipWait(1) { MsgBox("No text was copied. Please select some text first.") return } lowerText := StrLower(A_Clipboard) ; Capitalize the first letter, preserve rest if StrLen(lowerText) > 0 formattedText := StrUpper(SubStr(lowerText, 1, 1)) . SubStr(lowerText, 2) else formattedText := lowerText A_Clipboard := formattedText Sleep(50) Send("^v") ; Paste the modified text Sleep(50) A_Clipboard := ClipSaved ; Restore original clipboard }
This script is great for fixing messy sentences without having to manually rewrite them. It copies, processes, and pastes your selection seamlessly, while keeping the original clipboard content intact.
Your keyboard isn't just a tool, it's a command center. These 14 scripts give you control, speed, and flexibility you didn't realize you were missing. Whether you implement a few or all of them, each script will create a faster, smoother, more efficient workflow.
Try them out, modify what doesn't work, make them your own, then forget they were ever "scripts" in the first place. Before long, each of them will quietly become second nature.
You should read it
- Work more efficiently with the free AutoHotkey tool
- Control remote computers with Dropbox and AutoHotkey
- Create shortcuts with AutoHotkey
- How to create a time tracking application on Windows with AutoHotKey
- Managing Windows networks using Script - Part 13: The script returns all values
- Use Google applications more efficiently with Google Apps Script
- How to Enable and Use Script Execution Policy in Windows PowerShell
- How to create and run a shell script in Ubuntu 20.04 LTS
May be interested
- How to make the script executable anywhere in Linuxwhen you create a bash script and save it to a directory, you'll find that you can only execute the script while in that directory. by adding multiple links to it, you can also make your script executable everywhere.
- Office Scripts with the ability to automate routine tasks in Excel is now available on the webmicrosoft has officially announced that the office scripts feature is now supporting excel on the web for all eligible users. to use, you just need to click on the automate tab on the menu bar.
- What is a shell?shell is an environment in which we can run commands, programs and shell scripts. there are different versions of shell, which differ only from the version of the operating system. each version of shell has its own set of recognized commands and functions.
- 5 IF commands help use Batch script smarterif you have to do a lot of work with windows batch files, the if command is a very powerful tool to increase the flexibility of these scripts. this article will introduce you to the 5 if commands used for batch files along with the exact syntax and specific examples for each command.
- Manage Windows networks using scripts - Part 6: First steps for remote scriptinglearn remote scripting techniques (write scripts that run on remote machines) using the wmi win32_networkadapterconfiguration class that was introduced in the previous section.
- Managing Windows networks using scripts - Part 5: Overcoming challengesearlier in this series, we began to explore new things about the win32_networkadapterconfiguration class. this powerful wmi class has 61 properties and 41 methods, which can be used for querying and changing tcp / ip network settings on windows machines. we will need to explore the powerful feature of this wmi class in
- Managing Windows Networks with Scripts - Part 10: Tricks of remote control scriptsin the previous articles, we have been introduced to some concepts and issues around remote windows scripting. in this section, i will continue the discussion by showing you two tricks related to this remote script using wmi script written in vbscript.
- Manage Windows networks using scripts - Part 2: Complete scriptsin the previous section we have learned some basic concepts of scripting techniques such as objects, methods, properties and writing a simple scritp that changes the ip address assigned to adapters. in this second part, we will implement variable definition, error control, use input data and confirm the output data we need to add to get a scr.
- How to create and run shell scripts in Ubuntu 22.04shell is a user-written command interpreter. script shell helps users write and execute multiple commands at the same time. in this article, readers will learn how to execute shell scripts through command line input.
- How to use Local Group Policy Editor to tweak your computerthis article will show you how to use local group policy editor to make computer changes.