Redrodan Posted July 2, 2008 Share Posted July 2, 2008 (edited) Im a bit new to the Autoit world but Im trying to learn. I have started creating a script that will start our application, process a file and once that file is processed open the next one. After each file is processed I check the memory with ProcessGetStats().Id rather not use sleep() since the time to process can range from 20sec to 2min. Is there an easy way to detect that an application is idle (CPU 0)?I spend a some time searching and I found _ProcessListProperties()http://www.autoitscript.com/forum/index.ph...ew_post&f=2This seems to get the information but Im not sure how to use it in an If/then situation.If application is idle CPU OThen process next fileElse try again laterEdit: Ug...typo on title Detect not detach. Doesn't look like I can edit that Edited July 2, 2008 by Redrodan Link to comment Share on other sites More sharing options...
Airwolf Posted July 2, 2008 Share Posted July 2, 2008 Use a loop with a very short sleep timeout (you can sleep for 1ms if you'd like - 1/1000th of a second). ;In this example, use _ProcessListProperties() or something comparable to find the value of the CPU load and assign the value to $cpuload. While 1 If $cpuload = 0 Then ;Do whatever you want to when the cpu load is 0 ExitLoop EndIf Sleep(250) ;sleep for 1/4 of a second - 250ms WEnd Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt 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