Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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.

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
×
×
  • Create New...