Jump to content

Waiting for Application Loading - WinWaitActive Insufficient


Recommended Posts

Hey Guys, I'm new so go easy on me.

I need a script to monitor an application as it loads and run some simple Send() commands after it is up and running, however, WinWaitActive() seems to trigger the follow-on actions too early, so I'm attempting to create my own, more robust version.

My first attempt is to do something like this:

Func MyWWA($title)
     $CPU_Usage = 100
     While $CPU_Usage > 10
          WinActivate( "Windows Task Manager" )
          $text = WinGetText( "Windows Task Manager" )
          ; parse text to extract CPU Usage %
          ; if CPU Usage % > 10, then the application is still running
          ; Sleep 100
          WinWaitActive($title)
     Wend
EndFunc

It'll active an already open Windows Task Manager, read in the window text, parse it down to a 1~3 digit integer, and loop until the CPU calms down indicating the program is ready to go.

My first problem is the CPU Usage number only appears in the StatusBar of the windows task manager. How do I read this text into a variable?

My large-scale problem is even this is a crude method; what's a more reliable method?

Many thanks,

- Eric

Edited by AutoFalk3r
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...