How do I send a key multiple times in Autohotkey?

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

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

Try using Send {Tab 10}

Repeating or Holding Down a Key

To repeat a keystroke: Enclose in braces the name of the key followed by the number of times to repeat it. For example:

Send {DEL 4}   ; Presses the Delete key 4 times.
Send {S 30}    ; Sends 30 uppercase S characters.
Send +{TAB 4}  ; Presses Shift-Tab 4 times.

Source: AutoHotkey - Send / SendRaw / SendInput / SendPlay / SendEvent: Send Keys & Clicks


This also works with ControlSend and ControlSendRaw

ControlSend, Edit1, {Enter 5}, Untitled - Notepad

Tags:

Autohotkey