Im looking to make keystrokes look typed. Is there a way to randomize the setkeydelay? Im an extreme noob to autohotkey, I sortta learned how to do the send and how to set the key delay from just google searching and this forum, but I cant seem to find any answers online as to how to make the text appear as if its being typed.
Random delay between keystrokes
Can you give more details on what you are trying to do? Are you using the Send command to send keystrokes in sequence, and want there to be a random time in between strokes. Or are you wanting something different? Details are our friends. ![]()
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
Exactly that. The script is literally just sleep for a few seconds (for me to switch windows), set key delay, then send with a bunch of text. I just want each letter to be type at a random interval between like... .05 seconds and .3 seconds or so.
You can use the Send command with a function that Uses the Random command:
f1::
{
sendinput, A
sleep, % ran(50, 300)
sendinput, B
sleep, % ran(50, 300)
sendinput, C
sleep, % ran(50, 300)
sendinput, D
sleep, % ran(50, 300)
}
return
ran(min, max)
{
random, ran, min, max
return ran
}
This should produce a random pause between 50ms and 300ms in between each character. If you are wanting to really simulate a human typing I would suggest you increase the time. Humans just don't type that fast normally. ![]()
Edit:
I made the change suggested by Alpha Bravo... Sometimes I am in too much of a hurry and I make ridiculous coding errors. Usually I find and fix them in testing. ![]()
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
I believe dmg meant for the function to look like so
ran(min, max)
{
random, ran, min, max
return ran
}
I think what Im looking for isnt going to happen. I have pages I want it to type, and to do a random sleep time between each letter would take ages to do. Thanks for the help though. And on a side note, I have no idea how fast people type, I was just randomly guessing. Maybe .1-.5 then, or whatever. lol.
Thank you Alpha Bravo. ![]()
Yes, typing out pages of data, even with no delays, would take a bit of time. Why are you trying to simulate human typing? I have answered questions like this before but they were always about fooling a video game security system.
If you were wanting to input large amounts of text as fast as possible, and you did not have to worry about pretending to be human, you could just paste the content by assigning it to the clipboard and sending Ctrl-V.
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
lmao! Thanks for the clipboard tip. Been working on computers for years so I know that one. The human simulation is obviously a must for my needs. Otherwise why would I bother with a delay at all? But no, not a video game security issue.
Send % sendAtRandom("I want to send this string with random delays between keystrokes.")
sendAtRandom(string) {
Loop, parse, string
{
Send % A_LoopField
Random, t, 50, 300
Sleep, %t%
}
}



Sign In
Create Account
Last active: May 06 2013 06:49 AM
Back to top
