Jump to content

Difference between Send(n) and n*Send(1)


yookee
 Share

Recommended Posts

For Example

Send("{TAB " & $n & "}")

and

For $i = 1 To $n

Send("{TAB}")

Next

They may be same one. As if set SendKeyDelay before them, there is little difference.

In later codes, of course, a SendKeyDelay between twice Send()s. Then how is the former? In Send(n) on my computer, it seem delay "Default" delay.

Opt("SendKeyDelay", 40) befit me, 30ms go wrong.

Default SendKeyDelay is 5ms in help.

Link to comment
Share on other sites

For Example

Send("{TAB " & $n & "}")

and

For $i = 1 To $n

Send("{TAB}")

Next

They may be same one. As if set SendKeyDelay before them, there is little difference.

In later codes, of course, a SendKeyDelay between twice Send()s. Then how is the former? In Send(n) on my computer, it seem delay "Default" delay.

Opt("SendKeyDelay", 40) befit me, 30ms go wrong.

Default SendKeyDelay is 5ms in help.

I don't see what the question is. The delay is very consistent. The total time for one key send is SendKeyDelay plus SendKeyDownDelay, which by default is 5ms + 5ms = 10ms. Changing the SendKeyDelay gives very consistent results when tested:
$n = 20

Opt("SendKeyDelay", 40)

$iTimer = TimerInit()
Send("{TAB " & $n & "}")
ConsoleWrite("Send() with delay = 40:  " & Round(TimerDiff($iTimer)) & "ms" & @LF)

$iTimer = TimerInit()
For $i = 1 To $n
    Send("{TAB}")
Next
ConsoleWrite("Loop with delay = 40:  " & Round(TimerDiff($iTimer)) & "ms" & @LF)

Opt("SendKeyDelay", 5)

$iTimer = TimerInit()
Send("{TAB " & $n & "}")
ConsoleWrite("Send() with delay = 5:  " & Round(TimerDiff($iTimer)) & "ms" & @LF)

$iTimer = TimerInit()
For $i = 1 To $n
    Send("{TAB}")
Next
ConsoleWrite("Loop with delay = 5:  " & Round(TimerDiff($iTimer)) & "ms" & @LF)

Opt("SendKeyDelay", 0)

$iTimer = TimerInit()
Send("{TAB " & $n & "}")
ConsoleWrite("Send() with delay = 0:  " & Round(TimerDiff($iTimer)) & "ms" & @LF)

$iTimer = TimerInit()
For $i = 1 To $n
    Send("{TAB}")
Next
ConsoleWrite("Loop with delay = 0:  " & Round(TimerDiff($iTimer)) & "ms" & @LF)

Results:

>Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "C:\temp\Test.au3" 
Send() with delay = 40:  935ms
Loop with delay = 40:  936ms
Send() with delay = 5:  208ms
Loop with delay = 5:  207ms
Send() with delay = 0:  102ms
Loop with delay = 0:  106ms
+>10:27:05 AutoIT3.exe ended.rc:0

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...