Gyaaniguy_
self-made · nerd
windows 1 min read June 2024

Text macros with autohotkey on windows

We setup easy to remember hotkeys, to avoid typing same phrase again and again.

Tired of typing your name / address / email / or a plain "thank you" over and over? This sets up easy-to-remember hotkeys that expand short triggers into longer phrases.

Quick Instructions

  1. Install Autohotkey
  2. Open notepad, paste the code shown below and save as something.ahk. Make sure it's not something.ahk.txt.
  3. Right click the something.ahk file > Run as admin. An 'H' icon should appear in your notification area.

Done !

Usage / Test

  1. Open notepad
  2. Type: Ctrl+9
  3. Type 't' -> 'Thank you' should be typed automatically
  4. Type 'd' -> Tomorrow's date should be typed

Code

#Persistent
#InstallKeybdHook
DetectHiddenWindows, ON
SetKeyDelay, 1

^9::
Input Key, L1
if Key = w
    Send wtf
else if Key = t
    Send Thank you
else if Key = d
{
    Tomorrow = %a_now%
    Tomorrow += 1, Days
    FormatTime, Tomorrow1, %Tomorrow%, yyyy-MM-dd
    Send Tomorrow %Tomorrow1%
}

Configuring

The code should be self explanatory. But all you need to do is add more else if blocks at the end.

Example:

else if Key = e
    Send nik.jain@gmail.com
else if Key = n
    Send Nikhil Jain

The End

I hope that was helpful.