Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase input time between keystrokes using AutoHotKey

Tags:

autohotkey

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!

like image 732
wickstopher Avatar asked Feb 16 '23 15:02

wickstopher


2 Answers

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
}
}
like image 151
Avi Avatar answered Feb 23 '23 01:02

Avi


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
like image 37
Robert Ilbrink Avatar answered Feb 23 '23 00:02

Robert Ilbrink