autohotkey

How to increase input time between keystrokes using 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!


Solution

  • 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
    }
    }