Sign in to follow this  
Followers 0
meatsack

Any ways to make Send keys execute faster?

2 posts in this topic

#1 ·  Posted (edited)

Are there any ways to make Send keys execute faster? So after 2 weeks of tinkering with Autoit I have determine there are at least 3 ways to send keystrokes to applications.

1. Send

2. Controlsend

3. create a simulated USB HUB and Keyboard http://www.autoitscript.com/forum/index.php?showtopic=106963&st=0&p=765774&hl=send%20keyboard&fromsearch=1&#entry765774 How do I do this is there sample code?

4. other?

bad: so slow , still subject to error when a semideaf.com window pops up and takes over focus, won't work when a game such as half-life has focus? When I lower Sleep time to only 15 it hangs(don't know why)

good: works, don't have to worry about which window has focus

[autoit ] Opt("WinWaitDelay",1000)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Send("{LWINDOWN}d{LWINUP}")

Sleep(500)

Send("{LWINDOWN}{LWINUP}")

Sleep(500)

Send("{ESC}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("2")

Sleep(500)

Send("{ENTER}")

Sleep(500)

Send("{LWINDOWN}d{LWINUP}")

Sleep(500)

Send("{LWINDOWN}{LWINUP}")

Sleep(500)

Send("{ESC}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("e")

Sleep(500)

Send("{ENTER}")

Sleep(500) [/autoit ]

This site was helpful http://www.edgeofnowhere.cc/viewtopic.php?t=160857

Edited by meatsack

Share this post


Link to post
Share on other sites



To make your script as fast as possible I would change the code to send a key and then wait for the action to complete (that means replace the sleep with a command that waits for completion of the action).

Lets say one of the keys you send opens a new window. So after the window I would do a winwait. Then you could send a winactivate to make sure the window is active and no other application has taken over focus.

That's very general but the actions you have to take depend on the application you want to automate.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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