Sign in to follow this  
Followers 0

SendKeyDelay Question

2 posts in this topic

Posted (edited)

I want to know if i understand this correctly. Send Key Delay is defined in the online documentation as:

SendKeyDelay - Alters the the length of the brief pause in between sent keystrokes.

Time in milliseconds to pause (default=5). Sometimes a value of 0 does not work; use 1 instead.

This is listed in the function reference for autoit options.

http://www.autoitscript.com/autoit3/docs/f...xpandEnvStrings

The way i read this and understand it is that if i were to type up a code like:

Opt ("SendKeyDelay", 5000)

Send ("1")

Send ("2")

Send ("3")

it would wait 5 seconds before typing each number. (guess i could have just tried it but i just thought of that as i typed this) If i understand it right, it will leave the 5 second delay that way for the rest of the script unless i change it. So every time i use a succesive Send command it will wait 5 seconds. Or does it wait 5 seconds from the time it hits the Send command to actually send the keystroke?

Based on this am i correct in saying that SendKeyDelay is not a replacement for:

Send ("1")

Sleep ("2000")

Send ("2")

Sleep ("3000")

Send ("3")

It would not work in this manner since i want to change the wait time between keystrokes. If all this is correct then is there any method for combining the Send command and Sleep command that does not require writing 2 seperate lines, or is that the most efficent way of doing it?

btw i know my spelling and grammer is bad but hopefully it gets the point across. Thankyou for any help.

Edited by Physical

Share this post


Link to post
Share on other sites



Posted (edited)

SendKeyDelay ("5000")

Send ("1")

Send ("2")

Send ("3")

it would wait 5 seconds before typing each number. (guess i could have just tried it but i just thought of that as i typed this) If i understand it right, it will leave the 5 second delay that way for the rest of the script unless i change it. So every time i use a succesive Send command it will wait 5 seconds. Or does it wait 5 seconds from the time it hits the Send command to actually send the keystroke?

Correct. Sort of. The way to use SendKeyDelay is like this:

opt("SendKeyDelay",5000)

Based on this am i correct in saying that SendKeyDelay is not a replacement for:

Send ("1")

Sleep ("2000")

Send ("2")

Sleep ("3000")

Send ("3")

It would not work in this manner since i want to change the wait time between keystrokes. If all this is correct then is there any method for combining the Send command and Sleep command that does not require writing 2 seperate lines, or is that the most efficent way of doing it?

Correct again. If you want the delay time to change you should probably just use a sleep.

If there's a logic to it, and you are doing a lot of numbers for example, you can use a loop probably. eg:

For $x = 1 to 9
    Send($x)
    Sleep(($x+1) * 1000)
Next
Edited by covaks

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