$vk31::
$vk32::
$vk33::
$vk34::
$vk35::
$vk36::
$vk37::
$vk38::
$vk39::
$vk30::
Counter:=
SetTimer, SendKey, 1
KeyWait, % A_ThisHotkey
Return
SendKey:
Counter++
If Counter=50
{
SetTimer, SendKey, Off
Counter:=
}
Send, % "{"SubStr(A_ThisHotkey, 2)"}"
Return
Можно ещё так, разницы нет:
#UseHook
vk31::
vk32::
vk33::
vk34::
vk35::
vk36::
vk37::
vk38::
vk39::
vk30::
Counter:=
SetTimer, SendKey, 1
KeyWait, % A_ThisHotkey
Return
SendKey:
Counter++
If Counter=50
{
SetTimer, SendKey, Off
Counter:=
}
Send, % "{"A_ThisHotkey "}"
Return
, еще пара вариантов:
#UseHook
vk31::
vk32::
vk33::
vk34::
vk35::
vk36::
vk37::
vk38::
vk39::
vk30::
Counter:=
Start ? Stop:=1:Stop:=0
Start:=1
While Counter<50
{
If Stop
Break
Counter++
Send, % "{"A_ThisHotkey "}"
Sleep, -1
}
Stop:=Start:=0, Counter:=
KeyWait, % A_ThisHotkey
Return
#UseHook
vk31::
vk32::
vk33::
vk34::
vk35::
vk36::
vk37::
vk38::
vk39::
vk30::
Counter:=
Stop:=Start ? 1:0
Start:=1
Loop
{
If Stop
Or Counter=50
Break
Counter++
Send, % "{"A_ThisHotkey "}"
Sleep, -1
}
Stop:=Start:=0, Counter:=
KeyWait, % A_ThisHotkey
Return
Хотя таймер явно проигрывает циклу в скорости:
SetFormat, Float, 0.3
$vk31::
Start:=A_TickCount
Counter:=
SetTimer, SendKey, 1
KeyWait, vk31
Return
SendKey:
Counter++
If Counter=50
{
TrayTip,, % (A_TickCount-Start)/1000 " sec."
SetTimer, SendKey, Off
Start:=Counter:=
}
Send, {vk31}
Return
$vk32::
StartCount:=A_TickCount
Counter:=
Stop:=Start ? 1:0
Start:=1
Loop
{
If Stop
Or Counter=50
Break
Counter++
Send, {vk32}
Sleep, -1
}
TrayTip,, % (A_TickCount-StartCount)/1000 " sec."
Stop:=Start:=0, StartCount:=Counter:=
KeyWait, vk32
Return
, всё же он более стабильнее.