Wednesday, August 6, 2008

AHK - SendDelay()

This function will have a script send "key" only once every "delay" milliseconds.
SendDelay(key,delay) {
Global
If (lastSent_%key% = "" || lastSent_%key% < A_TickCount - delay)
{
Send %key%
lastSent_%key% := A_TickCount
Return 1
}
Return 0
}
For example, the following script will send the "a" key once every 1.5 seconds.
Loop
SendDelay("a",1500)
For a better example, see the post AHK - World of Warcraft - Shaman ES/SS spam

No comments: