How do I send a key multiple times in Autohotkey?

Viewed 43040

I want to write an AutoHotkey script which presses a key X number of times. For example, here's a script which presses Tab 10 times.

Send, {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}

While the above solution works, it's a bit unwieldy.

Is there a better solution for sending a key multiple times?

2 Answers

If you want the repeat in a loop, let's say every 3 seconds:

#a::   ; Win+a
Loop, 10
{
    SendInput {Tab}
    Sleep, 3000
}
Related