4
votes

I'm using an AutoHotKey script in Windows 7 to send the contents of the clipboard as a series of keystrokes. I'm very new to AutoHotKey, but I was wondering if there was some way to adjust the time between each keystrokes that it sends. Currently, the only line in my script is as follows:

^!k:: Send %clipboard%

I'd like to be able to increase the time between keystrokes (currently it seems to be on the order of about 50 characters per second) to more like 10 characters per second.

I'm using this to send keystrokes to a microcontroller using a terminal emulator. I'm having issues in that when I actually type in the keystrokes manually, everything registers as it should, but when I send the clipboard contents as keystrokes, something goes wrong, and I was hoping to slow down the rate of input in an attempt to pinpoint the issue. Essentially, I'd like to rule out the speed of input as an issue before attempting another more complicated solution.

If anybody has any ideas it'd be much appreciated. Thanks!

3

3 Answers

5
votes

You can use this function

USING

Sendpersec(Clipboard, 10)

OR

Sendpersec("jdkfjdkjdfkjdfkjdfkdfjdf", 5)

FUNCTION

Sendpersec(Data, Chs){
sleeptime := 1000 / Chs
IfLess,sleeptime,1
    sleeptime := 1
loop,
{
StringLeft,tosend,Data,1
Send, %tosend%
sleep,%sleeptime%
StringTrimLeft,Data,Data,1
IfEqual,Data
    break
}
}
2
votes

An easy way to increase the typing speed is to use SendInput instead of Send. This will "type" much faster ! Alternatively, you can store the string in ClipBoard and use Send, ^v to send it.

Example:

Clipboard= Long string to type
Send, ^v
1
votes

Yes, use Sleep, DelayInMilliseconds. For example for 10 key strokes per second, you'd use a delay of 100

http://www.autohotkey.com/docs/commands/Sleep.htm

EDIT: Maybe you want this then: SetKeyDelay [, Delay, PressDuration, Play] "Sets the delay that will occur after each keystroke sent by Send and ControlSend."

http://www.autohotkey.com/docs/commands/SetKeyDelay.htm