Sign in to follow this  
Followers 0
Albertxu

How can I slow down the key stroke sent by controlsend

4 posts in this topic

Hi all. I am a beginner of AutoIt. I am really grateful for those people who made this wonderful script that we can make ourselves.

I want to develop a script that will look up a word from a word list in a pc dictionary by using controlsend function:

ControlSend($DicTitle, "", "Edit1", $Entry & "{Enter}", 0)

But unfortunately, this script is buggy for my dictionary program. For example, when I look up word "wicked", the dictinary shows "ckedwi", and the meaning actually returns that of "wi". Perhaps that's because the dictionary app react slower than AutoIt and may I slow down the keystroke?

And if so, how I can do that?

Have a nice day to all!

Share this post


Link to post
Share on other sites



Welcome Albertxu,

Add this before you send function

Opt('SendKeyDelay', 250); default 5. higher number = slower

Share this post


Link to post
Share on other sites

I'm not certain I understand your problem as I don't know what dictionary program is.

If you are sending the word "wicked" to the edit control you could try sending 1 word at a time, with a little sleep pause.

Something like this might suit you.

$win = "Untitled - Notepad"

_MyControlSend($win, "Hello")

Func _MyControlSend($DicTitle, $Entry)
    $aEntry = StringSplit($Entry, "") ; This willmake an array of all letters in string
    For $i = 1 To $aEntry[0]
        ControlSend($DicTitle, "", "Edit1", $aEntry[$i]) ;Send each character
        Sleep(50) ; short sleep delay of 50 ms
    Next
    ControlSend($DicTitle, "", "Edit1", "{Enter}") ;finished sending string, now send enter
EndFunc   ;==>_MyControlSend

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Welcome Albertxu,

Add this before you send function

Opt('SendKeyDelay', 250); default 5. higher number = slower

Hi MHZ, just reported to you that your code worked like a charm. I can't love you more since I had been working on this script for one whole day and couldn't figure it out.

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