The Key-Name Generator Every AHK Script Needs AHK v1 v2 Library

keyList — Generate Any AutoHotkey Key List in One Call


Ever sat there hand-typing F1 F2 F3 ... F24 just to fill a dropdown — and then doing it again for the numpad, the mouse buttons, and the modifier keys? keyList is the tiny AutoHotkey function that does it for you. Ask it for a group of keys by keyword, range, or exclusion, and it hands back a clean, ready-to-use list.

It’s one self-contained function with zero dependencies — drop it in, call it, done. And it ships in both AHK v1 and AHK v2, so it fits whatever you’re building.

Automate ⌨ and keys with this great AutoHotkey Function


Automate keyboard and keys with this great AutoHotkey Function

▶ Watch the video on YouTube

 

The one-liner: keyList("fkeys")F1 F2 F3 ... F24. That’s the whole idea.

What It Does


keyList creates a delimited list of AutoHotkey-compatible key names ready to be parsed. You give it three things (all optional): the keys to include, the keys to exclude, and the delimiter to join them with. It starts from what you include, subtracts what you exclude, and joins the result with your separator — perfect for commands like Hotkey and GetKeyState, or for populating a ComboBox.

  • No more typing key names — one call returns dozens of correctly-spelled AHK key names.
  • Include by keyword — pull in whole groups: fkeys, npad, msb, mods, and more.
  • Exclude what you don’t want — subtract groups, single keys, or ranges from the result.
  • Range shorthand — write 1-5 or a-h and it expands the range for you.
  • Your delimiter, your choice — space-separated by default, or pass any single character (comma, pipe, newline).

A Few Quick Examples


You CallYou Get
keyList()Everything — letters, numbers, punctuation, keyboard, mouse, modifiers.
keyList(“msb npad”)Mouse buttons and the numeric keypad.
keyList(“all”, “punct”)Everything except punctuation.
keyList(“a-h”)The letters a, b, c, d, e, f, g, h.
keyList(“fkeys”, , “`n”)Function keys, one per line — perfect for a ListBox.
Note: the result is a single string — pass it through StrSplit() to get an array you can drop straight into a DropDownList or loop over to register hotkeys.

Who It’s For


Anyone building AHK tools that let users pick a key: hotkey configurators, settings dialogs, key-remappers, macro builders, or any GUI with a “choose a key” dropdown. Instead of maintaining a hardcoded wall of key names, you generate exactly the list you need on the fly — and it stays correct.

Get keyList


keyList is just $0.00 and comes with both the v1 and v2 versions plus a complete user guide. No license keys, no setup — include the file and start calling it.

Brought to you by the-Automator.com — practical AutoHotkey tools for people who automate.

Comments are closed.