Jump to content

Have script wait while CPU % for a certain process is above 0


Stryk3r
 Share

Recommended Posts

Hi,

I am new to the AutoIT program but really like it so far, I have read through these forums and the help guide and was unable to find a way to achieve my result.

In my script I have an application that I open, then run a command. During this time the CPU % for this process goes up but there are no dialog boxes or other screens while it is running. I want it to wait until the CPU falls back to 0 before it continues running the next commands in the script, but I cannot figure out how to put this in the script as there is no direct function for it that I could see.

The main window is active throughout and I can't think of any other way to make the script wait except using the sleep function. But since different computers will have different processing times the sleep function is not very accurate for this purpose, and it will be a really long wait on some computers, and not long enough on others causing the script to fail completely.

Any suggestions on how to achieve the results I need?

Thanks

Stryk3r

Link to comment
Share on other sites

Hi,

I am new to the AutoIT program but really like it so far, I have read through these forums and the help guide and was unable to find a way to achieve my result.

In my script I have an application that I open, then run a command. During this time the CPU % for this process goes up but there are no dialog boxes or other screens while it is running. I want it to wait until the CPU falls back to 0 before it continues running the next commands in the script, but I cannot figure out how to put this in the script as there is no direct function for it that I could see.

The main window is active throughout and I can't think of any other way to make the script wait except using the sleep function. But since different computers will have different processing times the sleep function is not very accurate for this purpose, and it will be a really long wait on some computers, and not long enough on others causing the script to fail completely.

Any suggestions on how to achieve the results I need?

Thanks

Stryk3r

I wasn't able to find one example right away that struck me as "this is the exactly right way to do it" so I'll let you look for yourself.

A tip for searching the forums: put + signs before everything, so for your search I did "+read +CPU +usage" (without the quotes) it basically tells the search to require every word with a + sign.

Edited by exodius
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...