Jump to content

SendKeyDelay Question


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 9 years later...

hola§§....:blink:I'VE TRIED THIS         opt ("SendKeyDelay", 1000) after create a GUIEdit and there's no effect....i'll put bellow an example :

#include .......

GuiCreate ("Welcome!")

Local $idMyedit = GuiCtrlCreateEdit ("", 50, 50, 200, 200, $ES_AUTOVSCROLL)

GUISetState (@SW_SHOW)

Send("{END}")

WinWaitActive ("Welcome")

sleep (3000)

send ("Hello!...{sleep 100} How are you?? {sleep 100} {Enter} What's your name?")

Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>Example

.....after i run the script it will send this "Hello!...{sleep 100} How are you?? {sleep 100} {Enter} What's your name?" as a phrase not word by word even if i create the opt obove opt ("sendkeydelay", 30..)....so please guide me to the right way...i don't know maybe there's a mistake in my script...as i'm newbie to use Autoit...

NOTE: i tried the Opt ("SendKeyDelay", ***) obove the script in "Notepad" ofcource after i run it and it's worked perfectly.......I'm wondering if that opt works only after i run a program? and not after greate a GUI window?.....last qustion : id there's a posibility to run a MSG BOX or Gui window only one time ..( example window or msg box tells the user how to use the programe or the software and some info about the product..but the next time when he runs the programe it won't appears again)..i hope you can understand what i mean..Iappologize about my english language..Peace!.

 

Link to comment
Share on other sites

20 minutes ago, Kratos said:

a posibility to run a MSG BOX or Gui window only one time ....but the next time when he runs the programe it won't appears again).

Yes, set a flag to registry or to a ini file, everytime the program starts, read that flag, if it doesn't exist, show msgbox.

AS for the rest of the post, why didn't you put the whole code inside the code quote?

That send like works here, but, it seems the 100ms is more like 1000, there's a bigger delay than usual.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...