DanRiek Posted June 8, 2010 Share Posted June 8, 2010 I would like to create a procedure that runs behind the scenes that waits for a window to open then clicks a button on that window. The code is listed below and does work fine. The problem is that Autoit will use 5% CPU load waiting for the window. Is there a better way? While 1 = 1 WinWaitActive ("Test - Window") MouseClick ( "left", 487, 393) Wend Link to comment Share on other sites More sharing options...
Tvern Posted June 8, 2010 Share Posted June 8, 2010 Stay with me here, because this gets pretty complicated and in-depth. While 1 = 1 WinWaitActive ("Test - Window") MouseClick ( "left", 487, 393) sleep(10) Wend Link to comment Share on other sites More sharing options...
kaotkbliss Posted June 8, 2010 Share Posted June 8, 2010 add a sleep in there to slow down the looping a little, like maybe Sleep(10) 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
DanRiek Posted June 8, 2010 Author Share Posted June 8, 2010 This is the line that is causing the CPU utilization: WinWaitActive ("Test - Window") It is waiting for the window to appear. It is during this time that the procedure has a higher amount if CPU utilization. The window may not appear for hours but when it does the procedure run through and then begins to wait again for the window which may take hours to apear. Do you know of a better way of doing this code or am I in need of a different program? Thanks Link to comment Share on other sites More sharing options...
Yoriz Posted June 8, 2010 Share Posted June 8, 2010 Try this one. While 1 If WinActive("Test - Window") Then MouseClick ( "left", 487, 393) Sleep(100) ; adjust to how quick you want it to click all the while its active Else Sleep(100) EndIf Wend GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
DanRiek Posted June 8, 2010 Author Share Posted June 8, 2010 Thank you that does help. Link to comment Share on other sites More sharing options...
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