如果按下 RSHIFT 键,如何暂停一次按键的自动热键脚本
How to suspend the autohotkey script for just one keystroke if the RSHIFT key is pressed
我有以下自动热键脚本。我希望 (1) 当我按下并释放 RShift 时,脚本会在下一次击键时暂停(即,仅按下一次按键)和 (2) 当我按住 RShift 时,脚本会暂停,直到我释放 RShift。
不幸的是,下面的代码只执行 (2) 而不是 (1)。我正在寻找一个正确的代码来执行 (1) 和 (2)。
AppsKey::RButton
RShift::Suspend, On
RShift Up::Suspend, Off
RShift::
KeyWait, RShift, T0.3
; Release RShift in less than 0,3 seconds after pressing it
; to suspend the script for the next keystroke
If (!ErrorLevel)
{
Suspend On
; BlockInput On
SetTimer OneKeyPressed, 200
}
else
{
; Hold RShift pressed for more than 0,3 seconds
; to suspend until you release RShift
while GetKeyState("RShift", "P")
Suspend On
KeyWait, RShift, L
Suspend, Off
}
return
#If A_IsSuspended
RShift Up:: Suspend, Off
#If
OneKeyPressed:
If (A_TimeIdlePhysical < 100)
{
SetTimer OneKeyPressed, off
; BlockInput Off
Suspend Off
}
return
我有以下自动热键脚本。我希望 (1) 当我按下并释放 RShift 时,脚本会在下一次击键时暂停(即,仅按下一次按键)和 (2) 当我按住 RShift 时,脚本会暂停,直到我释放 RShift。 不幸的是,下面的代码只执行 (2) 而不是 (1)。我正在寻找一个正确的代码来执行 (1) 和 (2)。
AppsKey::RButton
RShift::Suspend, On
RShift Up::Suspend, Off
RShift::
KeyWait, RShift, T0.3
; Release RShift in less than 0,3 seconds after pressing it
; to suspend the script for the next keystroke
If (!ErrorLevel)
{
Suspend On
; BlockInput On
SetTimer OneKeyPressed, 200
}
else
{
; Hold RShift pressed for more than 0,3 seconds
; to suspend until you release RShift
while GetKeyState("RShift", "P")
Suspend On
KeyWait, RShift, L
Suspend, Off
}
return
#If A_IsSuspended
RShift Up:: Suspend, Off
#If
OneKeyPressed:
If (A_TimeIdlePhysical < 100)
{
SetTimer OneKeyPressed, off
; BlockInput Off
Suspend Off
}
return