Guide to AutoHotKey
AutoHotKey is a tool for automating repetitive tasks, most commonly for easy text replacement as you type. Correcting common misspellings and inserting mathematical notation is made easy with short scripts that are simple to write and can be useful forever.
Setup
Download the current version of AutoHotKey, I’d recommend V2 however this guide is written for V1. After downloading it should create a script for you called AutoHotkey.ahk
. You can place this anywhere but I put it in my Documents. Once you’ve found a place for it, copy it and go to C:\Users\%UserName%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
. Finally right click and select Paste shortcut
. This will ensure that AutoHotkey runs on start up.
Editing your user script
To make any adjustments, which will be many at the start, find the AHK icon in the notification area. Right click and select Edit This Script
. This will open notepad for you to make changes in. Once you are done, save and then right click the AHK icon and select Reload This Script
Replacements
- Type " abc " replace with " xyz " — This is the most common expansion type thing and is very quick if you make a good system for yourself and remember it.
::abc::xyz
- Type " abc " replace with " xyz” — Note the missing space at the end. This is good for entering email adresses into forms and stuff
:o:abc::xyz
- Type “anthingabc " replace with “anythingxyz " — This is good for emoji and mathematical symbols
:?:abc::xyz
Key combinations
If you want to bind Ctrl+Q to some command, you can do:
^Q::Command
For reference ^
= ctrl, +
= shift, !
= Alt
AutoHotKey also refers to the scripting language with for loops, macros, etc. This is very powerful, as an example here is a I made for closing my browser when I hit F1
; Exiting Vivaldi browser and saving a session so that state is never lost
F1::
MouseMove,500, 15
Sleep 100
Click
Send {Alt}
Sleep 200
Send f
Send t
Sleep 200
Send, %A_YYYY%.%A_MM%.%A_DD%{space}
FormatTime, Time, ,H.mm
SendInput, %Time%
Sleep 200
Send {Enter}
Sleep 200
Send {Alt}
Sleep 750
Send f
Send x
Return
Examples of useful scripts
- Replace “ttt " with date stamp of format YYYY.MM.DD HH.MM
::ttt::
Send, %A_YYYY%.%A_MM%.%A_DD%{space}
FormatTime, Time, ,H.mm
SendInput, %Time%
Return
- Press
Ctrl+Space
to always keep window visible on top of other windows
^SPACE:: Winset, Alwaysontop, , A
Finally, here is a link to my full AHK script with personal information removed.