Code: Select all
KeyWait "c", "T.5"
if KeyWait==0 ;former: ErrorLevel
press c --> immedatly send c
hold c --> normal behaviour of c-button (means: ccccccc, each f.e. 0.5s)
double tab c --> send cr
tripple tab c --> send crr
Code: Select all
SendMode "Input"
SetKeyDelay 1
#Requires AutoHotkey v2.0
Global title := "AutoHotkey vers.: " A_AhkVersion
Global cKeyCount := 0
global SoundFreq := 600
global SoundDur := 100
;tooltip title
c::
{
SoundBeep SoundFreq, SoundDur
if (cKeyCount > 0)
{
Global cKeyCount += 1
}
else
{
SendEvent "{c}" ;immediatly send c
Global cKeyCount := 1
KeyWait "c", "T.5"
if KeyWait==0 ;former: ErrorLevel if c is hold down, send c each 0.5s
{
while (GetKeyState("c", "P"))
{
SendEvent "{c}"
SoundBeep SoundFreq*2, SoundDur/2
}
}
SetTimer cKey, -350
}
cKey() ;double tab c = cr, trippe tab c = crr - input time window 350ms
{
SendEvent (cKeyCount == 2 ? "{r}" : cKeyCount == 3 ? "{r 2}" : "")
Global cKeyCount := 0
}
}