Sign in to follow this  
Followers 0
Xibalba

Delayed key down not resulting in repeats?

7 posts in this topic

For (5)
  Send("{a down}")
  Sleep(200, 2000, 1)
  Send("{a up}")
  Send({ENTER})
Next

In notepad, the result is always:

a
a
a
a
a

When I expect something like this (depending on key delay in OS):

aaa
a
aa
aa
aaa

Have I missed something or why isn't some of the a's repeated?

Share this post


Link to post
Share on other sites



Sleep has no 'random' abilities built into it. Check the Random() function in the docs.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Sleep has no 'random' abilities built into it. Check the Random() function in the docs.

Yeah ok, I cheated. I didn't post my working code, since I'm fairly sure it isn't any syntax problem.

For the sake of it, I'm using a correct For-loop as well as this:

$delay = Random(200, 2000, 1)
Sleep($delay)

Question in OP remains.

Share this post


Link to post
Share on other sites

Try then increasing the range, say, 100 to 3500, that may help things.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Try then increasing the range, say, 100 to 3500, that may help things.

If I type with my own keyboard chars gets repeated after like 600ms... anyone?

Share this post


Link to post
Share on other sites

Not even this works:

Opt("SendKeyDownDelay", 3300)

Send("b")

Only one b is printed (in notepad)

Can't find more info about this by searching either.

halp

Share this post


Link to post
Share on other sites

Maybe do it like this..

For $i = 1 To 5
    $keys  = Random(1, 10, 1)
    $delay = Random(200, 2000, 1)
    For $j = 1 To $keys
        Send("{a}")
    Next
    Send("{ENTER}")
    Sleep($delay)
Next

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0