Sign in to follow this  
Followers 0
Azu

Send/Controlsend

7 posts in this topic

#1 ·  Posted (edited)

They work fine for me except that they type so SLOW, sometimes I can type stuff faster then autoit does with send/controlsend. How can I make it type faster? In other macros, like the one for G15, it can send all of the text instantly, rather then with long delays between each character. How can I set autoit to work like this, rather then taking forever?

NVM I found it..

opt("SendKeyDelay",0)
opt("SendKeyDownDelay",0)
Edited by Azu

Share this post


Link to post
Share on other sites



They work fine for me except that they type so SLOW, sometimes I can type stuff faster then autoit does with send/controlsend. How can I make it type faster? In other macros, like the one for G15, it can send all of the text instantly, rather then with long delays between each character. How can I set autoit to work like this, rather then taking forever?

See the Opt("SendKeyDelay",...) or the Opt("SendKeyDownDelay",...) .

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Sorry to revive this old thread but i've relatively the same issue than Azu.

Here's my issue..

I use Controlsend() to send text to a minimized window. And I set opt("SendKeyDelay",0) AND opt("SendKeyDownDelay",0) to type the text as fast as possible.

But sometime, for a unknown reason, even with opt("SendKeyDelay",0) AND opt("SendKeyDownDelay",0), I noticed that the text is typed very slowly.

I have to restart the script then the text is typed instantly. I run my script in loop and sometime, this happens on the first execution, sometime on the twentieth execution..

Does anyone has an idea why this happens??

EDIT: I'm on Win7.

Edited by cesars77

Share this post


Link to post
Share on other sites

Hard to tell without any code. Can you post a reproducer script? Something that will display the behaviour in notepad would be good.

Could if be that the target application is having trouble keeping up?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

this is the function i use.

Func _SEND($WINHANDLE, $KEYS)
    Return ControlSend($WINHANDLE, "", "", $KEYS)
EndFunc   ;==>_SEND

$WINHANDLE= the title of the window handled by the script

$KEYS= The text to send

This function works properly...I just need to know why sometime it starts to messing....

Edited by cesars77

Share this post


Link to post
Share on other sites

<snip>

This function works properly...

<snip>

That makes it less than usefull as a reproducer. It doesn't reproduce the problem you describe.

Opt("SendKeyDelay",0)
Opt("SendKeyDownDelay",0)

Run("Notepad.exe")
Global $iTimer
Global $hNotepad = WinWaitActive("[CLASS:Notepad]")
Global $sKeys = "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest{Enter}"
HotKeySet("{Esc}","_Exit")
While 1
    $iTimer = TimerInit()
    _SEND($hNotepad, $sKeys)
    If TimerDiff($iTimer) > 400 Then ConsoleWrite(TimerDiff($iTimer) & @CRLF)
WEnd

Func _SEND($WINHANDLE, $KEYS)
    Return ControlSend($WINHANDLE, "", "", $KEYS)
EndFunc   ;==>_SEND

Func _Exit()
    Exit
EndFunc

Seen as that never writes anything to the console for me it seems that it can keep up with 200 keys/sec, or 5ms per key. (It's usually about 3ms on my PC) It doesn't seem to ever slow down when running that example for a few minutes. As such I can think of four reasons for your problem:

1. There is an error in your script. (Not the part you posted)

2. The receiving application is having trouble keeping up

3. Some other process is hogging CPU

4. You need a better PC

If you could give us a script that reproduces the error we can try to figure out hat's going on. You could also try adjusting your script to send to notepad, to see if the problem is application based.

Looking at how you used ControlSend I'm guessing there are no control ID's to work with. Otherwise you could try using ControlSetText() which will be much faster for long strings.

Share this post


Link to post
Share on other sites

NVM, I found why...

Thx for your time Tvern.

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