我正在尝试使用 AutoHotKey 来解决辅助功能问题,但它并不像看起来那么自动。基本上,我想制作一个允许我打开或关闭“按住某个键”的脚本。理想情况下,这将是任何字母键,但我实际上只需要 W 和 X。我不知道该语言,但我的概念如下:
when user presses ctrl+caps_lock+w:
send w repeatedly
if user presses ctrl+caps_lock+w: end loop
谁能告诉我该怎么做?我觉得要花很长时间才能学会。
你可以尝试:
; Press w/x once to send down w/x repeatedly.
; Press w/x once again to stop the while-loop.
; Remove the lines with Sleep, if you don't want a delay.
#Requires AutoHotkey v1.1
#MaxThreadsPerHotkey 4
hold_w:= false
hold_x:= false
$w::
Send, {x Up}
Send, {w Up}
hold_x:= false
hold_w:= !hold_w
while hold_w
{
Send, {w down}
Sleep 1000 ; every 1 second
}
return
$x::
Send, {x Up}
Send, {w Up}
hold_w:= false
hold_x:= !hold_x
while hold_x
{
Send, {x down}
Sleep 500 ; every half second
}
return
; Press Esc to terminate the script.
Esc::
Send, {x Up}
Send, {w Up}
ExitApp
return