在输入 Autohotkey 期间让键盘与程序交互
Having keyboard interact with programs during input Autohotkey
我正在尝试创建一个程序,在没有按下任何键的情况下,只要 3 秒过去,就可以播放连续的 "beep" 声音。蜂鸣声一直持续到按下另一个键为止,这会重新开始 3 秒倒计时。
我希望程序在我打字时 运行 在后台运行。但是,当脚本处于 运行ning 状态时,其他程序(例如 Microsoft Word)不会响应击键。我尝试将 BlockInput 设置为 Off,但这并没有解决问题。关于让键盘与其他程序交互的任何想法?谢谢!
loop
{
Transform, CtrlQ, Chr, 17
Input, KeyPress, L1 M T3
if KeyPress = %CtrlQ%
ExitApp
if (ErrorLevel = "Timeout")
{
Run, Beep.mp3, Hide
Input, Cont, L1
if (ErrorLevel = "Max")
{
WinClose, Beep.mp3 - SMPlayer
}
}
}
loop {
if(A_TimeIdle >= 3000) {
sleep 100
IfWinNotExist, Beep.mp3 - SMPlayer
{
Run, Beep.mp3, Hide
}
} else {
IfWinExist, Beep.mp3 - SMPlayer
{
WinClose, Beep.mp3 - SMPlayer
}
}
}
^q::
ExitApp
return
在这种情况下,A_TimeIdle 可能是正确的函数。
other programs (such as Microsoft Word) do not respond to keystrokes
那是因为您的输入阻止了它们。添加 V
选项(代表可见),例如
Input, KeyPress, L1 M T3 V
这类似于热键的 ~
我正在尝试创建一个程序,在没有按下任何键的情况下,只要 3 秒过去,就可以播放连续的 "beep" 声音。蜂鸣声一直持续到按下另一个键为止,这会重新开始 3 秒倒计时。
我希望程序在我打字时 运行 在后台运行。但是,当脚本处于 运行ning 状态时,其他程序(例如 Microsoft Word)不会响应击键。我尝试将 BlockInput 设置为 Off,但这并没有解决问题。关于让键盘与其他程序交互的任何想法?谢谢!
loop
{
Transform, CtrlQ, Chr, 17
Input, KeyPress, L1 M T3
if KeyPress = %CtrlQ%
ExitApp
if (ErrorLevel = "Timeout")
{
Run, Beep.mp3, Hide
Input, Cont, L1
if (ErrorLevel = "Max")
{
WinClose, Beep.mp3 - SMPlayer
}
}
}
loop {
if(A_TimeIdle >= 3000) {
sleep 100
IfWinNotExist, Beep.mp3 - SMPlayer
{
Run, Beep.mp3, Hide
}
} else {
IfWinExist, Beep.mp3 - SMPlayer
{
WinClose, Beep.mp3 - SMPlayer
}
}
}
^q::
ExitApp
return
在这种情况下,A_TimeIdle 可能是正确的函数。
other programs (such as Microsoft Word) do not respond to keystrokes
那是因为您的输入阻止了它们。添加 V
选项(代表可见),例如
Input, KeyPress, L1 M T3 V
这类似于热键的 ~