我试图制作一个连续发出哔哔声的程序"声音随时3秒钟没有按任何键。哔声继续,直到按下另一个键,这将更新3秒倒计时。
我希望程序在我打字时在后台运行。但是,在脚本运行时,其他程序(如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
}
}
}
答案 0 :(得分:1)
其他程序(如Microsoft Word)不响应按键
那是因为你的输入会阻止它们。添加V
选项(代表可见),例如
Input, KeyPress, L1 M T3 V
这类似于热键的~
答案 1 :(得分:0)
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可能是正确的功能。