Help me someone please with this.
When I hold the key less then or equal to 200 ms and release it, ahk fires on action number one but not action two, three, four,... N,...
if I hold this key greater than 200 ms but less then or equal to 500 ms and release it, it's fire on action two, but not the others. if I hold key n ms, it fire on an action N and so on.
I think that it can be realised with help of timers but I'm not shure.
So, I need special behavior depends on how long I press the button down. But the number of options is unlimited here. I hope it's understandable =).
tripple-timer or n-timer as activator
Re: tripple-timer or n-timer as activator
Hallo,
This measures the hold time of key Q and acts accordingly:
This measures the hold time of key Q and acts accordingly:
Code: Select all
q::
HoldTime := -A_TickCount
KeyWait, q
HoldTime += A_TickCount
If HoldTime < 100
ToolTip,% HoldTime "ms is < 100ms"
Else If HoldTime < 400
ToolTip,% HoldTime "ms is 100 - 399ms"
Else
ToolTip,% HoldTime "ms is >= 400ms"
Return
Re: tripple-timer or n-timer as activator
Code: Select all
q::
KeyWait q
if (A_TimeSinceThisHotkey < 200)
action1()
else if (A_TimeSinceThisHotkey < 500)
action2()
else
action3()
Return
action1() {
}
action2() {
}
action3() {
}
Re: tripple-timer or n-timer as activator
or something like that?:
Code: Select all
q:: ;press key Q once or twice, short or long
SetTimer, Timer, Off
KeyWait, q
IF A_TimeSinceThisHotkey < 200
Record .= "S" ;Short press
Else
Record .= "L" ;Long press
IF StrLen(Record) > 1
Goto, Timer
SetTimer, Timer, -500
Return
Timer:
Switch Record
{
Case "S":Send, 1
Case "L":Send, One
Case "SS":Send, 2
Case "SL":Send, Two
Case "LS":Send, 3
Case "LL":Send, Three
}
Send, %A_Space%
;Tooltip for testing
ToolTip,% Record
Record =
Sleep, 1500
ToolTip
Return
Re: tripple-timer or n-timer as activator
yes, it's just what I need!
All of it works great and for me, a_tickcount is the best approach, for now. Thanks a lot
All of it works great and for me, a_tickcount is the best approach, for now. Thanks a lot