Skip to content

🤯 Practices Tips

Aluerie edited this page May 15, 2026 · 2 revisions

I rarely code with .ahk so here are some notes and reminders for future me.

1. Links

Name Link
Hotkeys autohotkey.com/docs/v2/Hotkeys.htm
KeyList https://www.autohotkey.com/docs/v2/KeyList.htm

2. Prefixes

#       Windows
!       Alt
^       Ctrl
+       Shift
~       Do not lose original key

I'm really not sure how to remember which is which 🤔.

3. Common mistakes

  1. Enumeration in AHK starts from 1 so array[1] fetches the first element (unlike other languages where it would be array[0])

  2. Do not use Q::ESC where Q is a Capital letter

    Probably, one of the most frequent mistakes/typos I do:

    Q::ESC  ; Incorrect, it interprets capital "Q" like we mean "Shift+q" 
    q::ESC  ; Correct.
  3. LWin key memes. For some reason, doing things like LWin & S::X or <#Tab::X disables functionalty of LWin::Y. Honourable mention:

    In past, we used this code to solve the screenshot problem in Dota 2.

    LWin & S:: {
        ; LShift -> LWin -> S
        if Getkeystate("LShift", "p") {
            Run("ms-screenclip:")
        }
        else {
            Send "{AppsKey} & {S}"
        }
    }
    
    LShift & S:: {
        ; LWin -> LShift -> S
        if Getkeystate("LWin", "p") {
            Run("ms-screenclip:")
        }
        else {
            Send "{LShift} & {S}"
        }
    }

    However, as noted it breaks LWin::AppsKey, so therefore do not do that^; find something simple, like a different keybind ^+P::Run("ms-screenclip:")

Clone this wiki locally