The script:
Code: Select all
\::
While GetKeyState("\","P")
{
send, {LCtrl down}
sleep, % _ran(18, 53)
send, {LCtrl up}
sleep, % _ran(19, 55)
}
return
_ran(min, max)
{
random, ran, %min%, %max%
return ran
}
Code: Select all
\::
While GetKeyState("\","P")
{
send, {LCtrl down}
sleep, % _ran(18, 53)
send, {LCtrl up}
sleep, % _ran(19, 55)
}
return
_ran(min, max)
{
random, ran, %min%, %max%
return ran
}
Code: Select all
\::
send, {LCtrl down}
sleep, % _ran(18, 53)
send, {LCtrl up}
sleep, % _ran(19, 55)
return
_ran(min, max)
{
random, ran, %min%, %max%
return ran
}
Code: Select all
#If !keyDown ; blank variables initialized as false
*q:: ; u press the key down, this label fires
ToolTip % A_ThisHotkey " pressed!`n" A_TickCount ; ur computation goes here
keyDown := true ; finally set this flag. This label can no longer fire
Return
#If
#If keyDown ; we're here now, flag is true, ur holding the key down and ur keyboard autorepeat keeps sending the key over and over again
*q::return ; this label will fire, we want to suppress the key, so we do
#If
; this label fires whenever u release the key unconditionally
*q Up::keyDown := false ; unset the flag
Esc::ExitApp
it doesn't really do anything for me, it keeps running, i only want it to play once when i press or hold the key, just the single senquence you know, like double-click 'x' - so i get 'xx' every time, not 'xxxxxxxx...'Qysh wrote:Like this?Code: Select all
\:: send, {LCtrl down} sleep, % _ran(18, 53) send, {LCtrl up} sleep, % _ran(19, 55) return _ran(min, max) { random, ran, %min%, %max% return ran }
well, thank you, but i don't really know how to implement it into my scriptswagfag wrote:heres something to suppress keyboard autorepeat, which is what i imagine youre after:Code: Select all
#If !keyDown ; blank variables initialized as false *q:: ; u press the key down, this label fires ToolTip % A_ThisHotkey " pressed!`n" A_TickCount ; ur computation goes here keyDown := true ; finally set this flag. This label can no longer fire Return #If #If keyDown ; we're here now, flag is true, ur holding the key down and ur keyboard autorepeat keeps sending the key over and over again *q::return ; this label will fire, we want to suppress the key, so we do #If ; this label fires whenever u release the key unconditionally *q Up::keyDown := false ; unset the flag Esc::ExitApp
so simple! works like a charm, thanks!!!