Deactivate autorepeat of a key
Deactivate autorepeat of a key
When I hold a key for a while, windows starts autorepeating. Is there an easy way to temporarily turn that behaviour off for a specific key?
Re: Deactivate autorepeat of a key
Code: Select all
Loop, Parse, % "ef" ; Block repetitions of these characters
Hotkey, $%A_LoopField%, Wait
Gosub, F3
F3::
block := !block
SoundBeep, 1500 - 500 * block
Return
Wait:
Send % hk := StrReplace(A_ThisHotkey, "$")
KeyWait, %hk%
Return
#If block
Re: Deactivate autorepeat of a key
Thank you! I don't really understand what you are doing with this script.
The F3 subroutine is executed twice (the first time through gosub, the second time by falling through), meaning that on is first set to true and then immediately to false, with the only effect that whatever hotkeys follow this part of the script will not be executed, unless the variable on is set true somewhere else or another #if follows...
Another problem with your solution is that the hotkey thread is blocked until the key is released. Looks like I'll have to program it with boolean variables manually.
The F3 subroutine is executed twice (the first time through gosub, the second time by falling through), meaning that on is first set to true and then immediately to false, with the only effect that whatever hotkeys follow this part of the script will not be executed, unless the variable on is set true somewhere else or another #if follows...
Another problem with your solution is that the hotkey thread is blocked until the key is released. Looks like I'll have to program it with boolean variables manually.
Re: Deactivate autorepeat of a key
Wrong both times.
There is an implicit Return before the first hotkey. Nothing is blocked.
The best way to see this in action is to try the script.
There is an implicit Return before the first hotkey. Nothing is blocked.
The best way to see this in action is to try the script.
To start unblocked:After the script has been loaded, it begins executing at the top line, continuing until a Return, Exit, hotkey/hotstring label, or the physical end of the script is encountered (whichever comes first). This top portion of the script is referred to as the auto-execute section. Note: While the script's first hotkey/hotstring label has the same effect as return, other hotkeys and labels do not.
Code: Select all
Loop, Parse, % "ef" ; Block repetitions of these characters
Hotkey, $%A_LoopField%, Wait
; Gosub, F3
F3::
block := !block
SoundBeep, 1500 - 500 * block
Return
Wait:
Send % hk := StrReplace(A_ThisHotkey, "$")
KeyWait, %hk%
Return
#If block
#IfWin: the bottommost occurrence applies to newly created hotkeys unless "Hotkey IfWin" has executed since the script started.
Re: Deactivate autorepeat of a key
Well, that's a lot of tricks in a short script
Now I understand what you're doing.
Thank you
Now I understand what you're doing.
Thank you
Re: Deactivate autorepeat of a key
You are welcome. A similar way in case easier:
Code: Select all
F3::
block := !block
SoundBeep, 1500 - 500 * block
Return
#If block
$e::
$f::
Send % hk := StrReplace(A_ThisHotkey, "$")
KeyWait, %hk%
Return
#If
Who is online
Users browsing this forum: RussF and 119 guests