10 Cool AutoHotkey Scripts (And The way to Make Your Personal!)

If you're familiar with the many keyboard shortcuts in Windows and still feel like you need more, it's time to move on to an advanced tool that allows you to create your own scripts.

AutoHotkey (AHK) is the answer to your customization needs. This program lets you remap buttons, create custom shortcuts, run macros to automate repetitive tasks, and much more.

Let's look at some useful AutoHotkey scripts to get you started, as well as the basics of the software so you can create your own.

How to install AutoHotkey

Before you can use cool AHK scripts or create your own, you need to install AutoHotkey on your system.

Visit the AutoHotkey homepage and click Download, and choose Download the latest version to grab it. Go through the quick install dialog and you can start using AutoHotkey scripts.

How to create new AutoHotkey scripts

The program you just installed will take care of running AHK scripts, but it won't do anything until a script is actually running.

To create a new AutoHotkey script, right click anywhere on your desktop (or wherever it suits you) and select New> AutoHotkey script. Call it something that makes sense. Then right click on your new file and select Edit scriptor open the file in a text editor of your choice to start working.

New AutoHotkey script

Note that you can also open your text editor, enter an AutoHotkey script, and save it as a file that ends on .ahk to get the same result. Just make sure it has the correct file extension!

Speaking of which, updating your text editor from the simple editor is a good idea. Notepad ++ and Visual Studio Code are both great free options.

Now that you have the software to run AutoHotkey scripts, you can download scripts others have written to use them without having to do any work yourself. To save one, just download it as .ahk File and save it wherever you want.

To run a script, just double click on it and it will take effect. However, you probably want some of these scripts to run as soon as you start your computer so that you don't have to start them manually every time.

To do this, copy and paste the .ahk Files in your startup folder. You can get there easily by tapping Shell: start in the start menu. Otherwise, navigate to the following location:

Start Widnows folder

C: Users (USERNAME) AppData Roaming Microsoft Windows Start Menu Programs Start

AutoHotkey Script Startup Windows

This will load your AutoHotkey scripts as soon as you log into your computer.

The best AutoHotkey scripts to try out

Here are some of the most useful AutoHotkey scripts that you can download and use to instantly improve Windows. For more examples of AutoHotkey scripts, including those much more complex than this, see the AutoHotkey Script Showcase.

1. Autocorrect

Even with the precision of a desktop keyboard, you must make mistakes as you type. And while this is an old AHK script, typos don't go out of style.

Related topics: How to Enable Built-in AutoCorrect in Windows 10

It contains thousands of common misspellings. If you make a mistake, the correct word will immediately replace your mistake. You can even add your own words, which we will discuss later.

Download: AutoCorrect script

2. Disable the lock buttons

The three lock keys – Num Lock, Caps Lock, and Scroll Lock – aren't used that often in today's computer. You likely only use the numeric keypad for digits, just accidentally hit Caps Lock, and don't even care about the scroll lock.

If you rarely use these modifiers, try setting them to a default value with this script:

;; Set the lock buttons permanently
SetNumlockState, AlwaysOn
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff

This assumes that Num Lock should always be activated. If you prefer, just change that line (or remove it entirely and just change Caps Lock and Scroll Lock).

3. Use Caps Lock again

Once you've used the above script to disable Caps Lock, it makes sense to give this key some other purpose.

Using this short script will convert Caps Lock to a different Shift key. However, you can change them to whatever you want (possibly a different Windows key if your keyboard only has one of them):

;; Turn Caps Lock into a toggle key
Capslock :: Shift

4. Quickly show or hide hidden files

It is important to understand how hidden files and folders are sometimes shown in Windows. If you only need access to hidden folders every now and then and don't want them to clutter your view normally, this is a useful script.

This script just lets you push Ctrl + F2 When File Explorer is open, you can toggle the display of hidden files or folders. That's all there is to it! All you need to do is copy the code from the linked forum post into a script:

^ F2 :: GoSub, CheckActiveWindow
ID: = WinExist ("A")
WinGetClass, Class, ahk_id% ID%
WClasses: = "CabinetWClass ExploreWClass"
IfInString, WClasses,% Class%
GoSub, Toggle_HiddenFiles_Display

SubKey = Software Microsoft Windows CurrentVersion Explorer Advanced

RegRead, HiddenFiles_Status,% RootKey,% SubKey, Hidden

if HiddenFiles_Status = 2
RegWrite, REG_DWORD,% RootKey,% SubKey, Hidden, 1
RegWrite, REG_DWORD,% RootKey,% SubKey, Hidden, 2
PostMessage, 0x111, 41504 ,,, ahk_id% ID%

Visit: Toggle hidden script

5. Quickly show or hide known file extensions

This one is similar to the one above in that it also deals with File Explorer. For security reasons, it is wise to always show file extensions. This makes it easier to spot unwanted EXE files disguised as PDF or something similar. This is also handy when you have to deal with Windows 10 file associations.

With the following script you can toggle the display of extensions for known file types Win + Y..

Download: Toggle the script for known file extensions

6. Insert special characters

Aside from the few special characters on your keyboard (like @ and *), there are dozens more that are not as conveniently accessible. One of the quickest ways to enter foreign characters and other unusual symbols is to use AutoHotkey.

With just one line of AHK code, you can quickly insert these special symbols and no longer have to memorize ALT codes or copy and paste them from an online list.

Use the following template to create the shortcuts that will be most useful to you. The characters to the left of the two colons are what you press to trigger the link, while the symbol in the brackets is what inserts the link.

For example, if you want to press Alt + Q. To insert the mark symbol, create a script with the following address:

! q :: SendInput {™}

For reference, the characters for keys are as follows. For more information on hotkeys, see the AutoHotkey manual page:

  • ^ to the Ctrl
  • ! to the Old
  • # to the victory
  • + to the shift

If you're a strong Google searcher, this handy shortcut can help you find copied text on your computer.

It will launch your default browser and search Google for any text that you highlighted when you pressed it Ctrl + Shift + C.. It's handy to keep cutting down on copying and pasting!

^ + c ::
Send, ^ c
Sleep 50
Run https://www.google.com/search?q=%clipboard%

8. Use the numpad as a mouse

While you can navigate Windows without a mouse if you need to, this script doesn't require you to memorize keyboard shortcuts to do so. This neatly organized AutoHotkey script uses your number pad as a mouse, giving you more precision and a way to move around your computer in the event of a hardware failure.

See the information at the top of the script for instructions on how to use it.

Download: Use the keyboard numpad as a mouse script

9. Start any app

You can access any program installed on your computer in seconds from the start menu. For your most frequently used programs, you may want an even faster way to start them.

The script to open an app is simple. Here is one that you can start Firefox with when you press Win + F.. Change it as needed for your preferred keyboard shortcut and app.

#f :: Run Firefox

10. Makeshift volume buttons

Most keyboards have buttons for easily changing the volume, changing the music track, and the like. However, if you don't have them, you can use AutoHotkey to create your own volume buttons.

Here is an example that uses Shift + Plus and Shift + Minus (Keys on the numeric keypad) to increase and decrease the volume. You can also meet the little-used ones Interruption Button to toggle the mute.

As with the other scripts, you can customize the buttons to your liking.

+ NumpadAdd :: Send {Volume_Up}
+ NumpadSub :: Send {Volume_Down}
break :: Send {Volume_Mute}

Write your own scripts

Once you feel confident, the next thing you can try is creating your own AutoHotkey scripts. If you are just starting out with AHK, you will likely benefit most from text expansion.

Read More: Best Text Expansion Tools For Windows

Essentially, text expansion lets you enter a small piece of text that will automatically expand into something much longer. If you send the same email multiple times a day, or keep typing your email address every time you log into websites, setting up text expansion will make you more productive.

If you downloaded the AutoCorrect script from # 1 above, there is a place below where you can add your own phrases. This is the perfect place to add a single line extension. If you don't use this script, just create a new script for your extension entries.

It's very simple: Enter two colons followed by the hotkey text. After two more colons, enter the phrase to which the link should be extended. So if you want to run the automatic extension "@@" on your email address, the script is as follows:

:: @@ :: youremail@domain.com

The possibilities here are diverse. You could do the hotkey Ctrl + Alt + C. Spit out a pre-defined email that you enter several times a day, or any number of other tasks relevant to your work:

^! c ::
Hello send, {enter} This is a predefined email.

Once you have a text extension set up, you can start remapping keys if you find that some of them are not useful in their current state.

For example, would you like the Paste button to be a shortcut to copy instead? You can change this as follows:

Insert :: ^ c

See the AutoHotkey tutorials for more information. For a more in-depth introduction to AHK, we have an AutoHotkey beginner's guide that you can read too.

The power of AutoHotkey

The great thing about AutoHotkey is that it can be completely customized to suit your needs. If all you want is automatic correction and a few simple text extensions, these can be easily set up. If you want to go deeper with lots of custom controls and complex shortcuts, you can write whatever script you want.

With these great AutoHotkey scripts, you don't need any programming experience to get started. For a similar tool, you should also look into the basics of Windows batch files.

Image credit: FabrikaSimf / Shutterstock

Microsoft Shake to minimize the function

Microsoft will remove the practical Windows function in the upcoming update

The window minimization function is expected to leave Windows 10 in early 2021.

About the author

Ben Stegner
(1609 articles published)

Ben is the Assistant Editor and Onboarding Manager at MakeUseOf. He left his IT job to write full-time in 2016 and has never looked back. For over six years he has been a professional writer reporting on technical tutorials, video game recommendations, and more.

By Ben Stegner

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive deals!

One more step …!

Please confirm your email address in the email we just sent you.

. "border =" 0

Leave a Reply

Your email address will not be published. Required fields are marked *