Autohotkey 中的数组?

Array in Autohotkey?

是否可以将此代码分配给多个键盘热键?

::
StringReplace, ThisKeyLabel, A_ThisLabel, $
While GetKeyState(ThisKeyLabel,"P")
{
    Random, r, 50, 250
    sleep r
    Send % ThisKeyLabel
}
return

其中 $1(热键 1)将替换为列表或数组。

例如:$hotkeys(W,A,S,D)

示例

; List of keys to bind
keys := "wasd"

; bind the keys to keypress_handler
Loop, parse, keys
    hotkey, ~%A_Loopfield%, keypress_handler

; our key handler
keypress_handler:
    StringReplace, ThisKeyLabel, A_ThisHotkey, $
    While GetKeyState(ThisKeyLabel,"P")
    {
        Random, r, 50, 250
        sleep r
        Send % ThisKeyLabel
    }
Return