6

How do I delay Send commands in AutoHotkey?

If AutoHotkey sends the keypresses faster than a program can register the inputs, words can end up mistyped with missing letters. (stuff ends up like stf, or wasd squad ends up like wsdsqad)

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
zulc22
  • 337
  • 2
  • 7
  • 17

2 Answers2

6

SetKeyDelay is what you need.

Note: SetKeyDelay is not obeyed by SendInput; there is no delay between keystrokes in that mode. This same is true for Send when SendMode Input is in effect.

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
AEonAX
  • 501
  • 12
  • 24
5

SetKeyDelay, Delay between keystrokes in milliseconds, PressDuration in milliseconds

Of course this doesn't work with SendInput formats, but it does work with Send and ControlSend commands

So if you wanted a half-second delay between keypresses and each key to be held down for a quarter of a second, it would look like this:

SetKeyDelay, 500, 250

A practical example would be:

SetKeyDelay, 500, 250

Send Sincerely,{enter}John Smith  

In this way, there would be a brief pause between keypresses and each key would be pressed a lot more like a real person would, thereby alleviating your probem of autohotkey sending keypresses faster than they can be registered.

MaurerPower
  • 2,046
  • 7
  • 26
  • 48