this is my example code.
capslock & a:: send {wheeldown}
and I used this for weeks now. everything works fine and I am happy it replaces 30 percent of my mouse usage.
but here's where the problem starts.
I use it quite frequently that sometimes I unexpectedly cause the hotkey to cease while in the middle of use.
the way hotkey sends the wheeldown event is like this as you know:
capslock pressed --> a pressed --> hotkey fires --> a released --> hotkey stops --> capslock released
or other people would release both keys at the same time.
the problem is, some of the time and by mistake, I release capslock key first while I still press "a" and if "a" is kept pressed long enough, it sends literal {a} key which is definitely not I want.
any solution to work this out? well for example, to make hotkey go on until "a" is released(but except for when a is used alone as literal character)
key accidentally released while pressing hotkey, how to prevent this?
Re: key accidentally released while pressing hotkey, how to prevent this?
It seems that when a is pressed, you want the following to happen.
1. If CAPSLOCK was pressed recently, do nothing.
2. If CAPSLOCK was not pressed recently, send a.
You could write a script for a that would do that. You can define "recently" according to when CAPSLOCK was last pressed. A_TickCount can be used to compute time differences. Store a value when you want, and then subtract it from the current value.
An alternative approach could simply be to set a short timer when CAPSLOCK is released. Block input until the timer expires.
1. If CAPSLOCK was pressed recently, do nothing.
2. If CAPSLOCK was not pressed recently, send a.
You could write a script for a that would do that. You can define "recently" according to when CAPSLOCK was last pressed. A_TickCount can be used to compute time differences. Store a value when you want, and then subtract it from the current value.
An alternative approach could simply be to set a short timer when CAPSLOCK is released. Block input until the timer expires.
Re: key accidentally released while pressing hotkey, how to prevent this?
thank you for the reply.
I think both ideas are great but stupid me, I don't have clue how to write the proper script to play with values and such.
would you mind offering test script so it's easier to understand how it goes?
couldn't be happier!
I think both ideas are great but stupid me, I don't have clue how to write the proper script to play with values and such.
would you mind offering test script so it's easier to understand how it goes?
couldn't be happier!
Re: key accidentally released while pressing hotkey, how to prevent this?
It's tricky to do. Have a look at some other threads in this forum regarding key up and key down. There is quite a bit of discussion about it. Below is one general idea that you can explore.
Code: Select all
^o::
SetTimer, Wait, -350
Send O
Return
Wait:
If GetKeyState("o") {
BlockInput, On
Sleep, 100
BlockInput, Off
}
SendEvent {Ctrl Up}{Shift Up}
Return