Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

SendKeyDelay Question


  • Please log in to reply
1 reply to this topic

#1 Physical

Physical

    Seeker

  • Active Members
  • 28 posts

Posted 07 May 2008 - 02:55 AM

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, 07 May 2008 - 02:58 AM.








#2 covaks

covaks

    Polymath

  • Active Members
  • PipPipPipPip
  • 249 posts

Posted 07 May 2008 - 03:04 AM

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, 07 May 2008 - 03:06 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users