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