Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 自动热键中的数组?_Arrays_List_Keyboard Shortcuts_Autohotkey_Hotkeys - Fatal编程技术网

Arrays 自动热键中的数组?

Arrays 自动热键中的数组?,arrays,list,keyboard-shortcuts,autohotkey,hotkeys,Arrays,List,Keyboard Shortcuts,Autohotkey,Hotkeys,是否可以将此代码分配给多个键盘热键 $1:: StringReplace, ThisKeyLabel, A_ThisLabel, $ While GetKeyState(ThisKeyLabel,"P") { Random, r, 50, 250 sleep r Send % ThisKeyLabel } return 其中$1(热键1)将替换为列表或数组 例如:$热键(W、A、S、D)示例 当Getkeystate函数时,如何用替换MsgBox函数的可能重复项?@Ga

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

$1::
StringReplace, ThisKeyLabel, A_ThisLabel, $
While GetKeyState(ThisKeyLabel,"P")
{
    Random, r, 50, 250
    sleep r
    Send % ThisKeyLabel
}
return
其中$1(热键1)将替换为列表或数组

例如:$热键(W、A、S、D)

示例
当Getkeystate函数时,如何用
替换
MsgBox
函数的可能重复项?@GabrielMeono已更新。对于numpad键,如何执行此操作?例如,Numpad1和Numpad2?执行循环行分析,而不是逐个字符的循环,请参阅AutoHotkey文档中有关循环的相应文档。:)<代码>~%A_Loopfield%
为什么~?这不是工作,这是工作
; 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