Jump to content
Sign in to follow this  
oMBRa

Send keystrokes quickly

Recommended Posts

oMBRa

Send() sends simulated keystrokes kinda slowly... how to do it very quickly?

Share this post


Link to post
Share on other sites
TehWhale

Opt("SendKeyDelay")

Share this post


Link to post
Share on other sites
oMBRa

I already used it but still slow... I want a speed like when u do Ctrl + V to paste some text

Share this post


Link to post
Share on other sites
Nahuel

That depends on what exactly you are trying to do.

Here's an example of an alternative way:

$text="This is a pretty long text that should appear in notepad really fast"
Run("notepad.exe")
WinWait("[Class:Notepad]")
ControlSetText("[Class:Notepad]","","[CLASS:Edit; INSTANCE:1]",$text)

Share this post


Link to post
Share on other sites
dgarrett8

You personally think it's? I think it's fast as hell.


"I think, therefore I am"[size="1"]René Descartes[/size]

Share this post


Link to post
Share on other sites
Nahuel

You personally think it's? I think it's fast as hell.

I think so too, but he wants the text to "appear" just like it does when you paste text on an editor.

Share this post


Link to post
Share on other sites
dgarrett8

I don't think that is possible..maybe I'm wrong


"I think, therefore I am"[size="1"]René Descartes[/size]

Share this post


Link to post
Share on other sites
Nahuel

I don't think that is possible..maybe I'm wrong

Click me Edited by Nahuel

Share this post


Link to post
Share on other sites
burners

AutoItSetOption("SendKeyDelay", 1)

AutoItSetOption("SendKeyDownDelay", 1)


~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Share this post


Link to post
Share on other sites
herewasplato

... I want a speed like when u do Ctrl + V to paste some text

The sample code posted by Nahuel should work for you unless your app (like some apps I work with) ignores* ControlSetText. In that case, use ClipPut("text") and ControlSend("^v") [or if you must - just use Send("^v")]

ClipPut("This is a pretty long text that should appear in notepad really fast")
Run("notepad.exe")
WinWait("[Class:Notepad]")
ControlSend("[Class:Notepad]","","[CLASS:Edit; INSTANCE:1]", "^v")
Sleep(1500)
WinClose("[Class:Notepad]")oÝ÷ ØKÞÚ-z  è­ë-ë^ÆÛ§¶)r¢ë½ëayø¥xò¢èî²×%¢Ç­ì"Ú06^¥§pYg¢Úk¢jmÊ­¢Æ¯y©òµìmªê-±éíªê-¶­¾&¢{k¢Tµ7±µ«­¢+ØÀÌØíÑáÐôÅÕ½ÐíQ¡¥Ì¥ÌÁÉÑÑä±½¹ÑáÐÑ¡ÐÍ¡½Õ±ÁÁÈ¥¸¹½ÑÁɱ±äÍÐÅÕ½Ðì)IÕ¸ ÅÕ½Ðí¹½ÑÁ¹áÅÕ½Ðì¤)]¥¹]¥Ð ÅÕ½Ðím
±ÍÌé9½ÑÁtÅÕ½Ðì¤)
½¹Ñɽ±MÑQáÐ ÅÕ½Ðím
±ÍÌé9½ÑÁtÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðím
1MLé¥Ðì%9MQ9
èÅtÅÕ½Ðì°ÀÌØíÑáФ)M±À ÄÔÀÀ¤)]¥¹
±½Í ÅÕ½Ðím
±ÍÌé9½ÑÁtÅÕ½Ðì

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
herewasplato

AutoItSetOption("SendKeyDelay", 1)

AutoItSetOption("SendKeyDownDelay", 1)

Welcome to the forum.

It would depend on the volume of data being sent as to the speed delta between the fastest Send and the other methods. Try this code.

AutoItSetOption("SendKeyDelay", 1)
AutoItSetOption("SendKeyDownDelay", 1)

Dim $t
For $i = 1 To 500
    $t &= String($i)
Next

Run("notepad.exe")
WinWait("[Class:Notepad]")
Send("Send  " & $t)
Sleep(1000)
ControlSend("[Class:Notepad]", "", "[CLASS:Edit; INSTANCE:1]", "^a{BS}")
Sleep(1000)

ClipPut($t)
Sleep(50)
ControlSend("[Class:Notepad]", "", "[CLASS:Edit; INSTANCE:1]", "Paste  " & "^v")
Sleep(2000)
ControlSend("[Class:Notepad]", "", "[CLASS:Edit; INSTANCE:1]", "^a{BS}")
Sleep(1000)

ControlSetText("[Class:Notepad]", "", "[CLASS:Edit; INSTANCE:1]", "ControlSetText  " & $t)
Sleep(2000)
WinClose("[Class:Notepad]")

@oMBra,

You can overwhelm the Windows clipboard if you repeatedly transfer data to and from it as fast as AutoIt can. The OS clipboard may fail you at max speed... It would be best to use a Sleep of about 50 or a 100 ms between each repeated clipboard operation.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
oMBRa

I already use clipboard but some letter can't be copied like "" and I cant use ControlSetText because the window isnt a windows application so I cant get the ID of the control

Share this post


Link to post
Share on other sites
herewasplato

I already use clipboard but some letter can't be copied like "" ...

So you are left with using
AutoItSetOption("SendKeyDelay", 1)
AutoItSetOption("SendKeyDownDelay", 1)
Send("^v" & "")
* or whatever it takes to send ""

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×