Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I delay send commands in AutoHotKey?

Tags:

autohotkey

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)

like image 452
zulc22 Avatar asked Dec 20 '14 07:12

zulc22


2 Answers

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.

like image 70
AEonAX Avatar answered Nov 10 '22 15:11

AEonAX


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.

like image 30
MaurerPower Avatar answered Nov 10 '22 13:11

MaurerPower