Reputation: 99
I'm trying to create a program that plays a continuous "beep" sound anytime 3 seconds have passed without any key being pressed. The beep sound continues until another key is pressed, which renews the 3 second countdown.
I want the program to run in the background while I'm typing. However, while the script is running, other programs (such as Microsoft Word) do not respond to keystrokes. I tried setting BlockInput to Off, but that didn't solve the problem. Any ideas on getting the keyboard to interact with other programs? Thanks!
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
}
}
}
Upvotes: 0
Views: 112
Reputation: 10852
other programs (such as Microsoft Word) do not respond to keystrokes
That's because your inputs block them. Add the V
option (which stands for visible), like
Input, KeyPress, L1 M T3 V
This is similar to ~
for Hotkeys
Upvotes: 1
Reputation: 301
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 might be the right function in this case.
Upvotes: 0