meatsack Posted January 29, 2010 Posted January 29, 2010 (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 January 29, 2010 by meatsack
water Posted January 29, 2010 Posted January 29, 2010 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now