victor Posted November 10, 2005 Share Posted November 10, 2005 (edited) how to check for cpu usage ? if mem is MemGetStats ( ) then what is cpu usage function ? just curious Edited November 10, 2005 by victor Link to comment Share on other sites More sharing options...
BigDod Posted November 10, 2005 Share Posted November 10, 2005 how to check for cpu usage ?if mem is MemGetStats ( ) then what is cpu usage function ?just curiousHere is some code I found a while back.run("taskmgr.exe","",@SW_HIDE) Sleep(1000) while 1 $rc = StatusBarGetText("Windows Task Manager","",2) Tooltip($rc,0,0) sleep(10) wend Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
victor Posted November 10, 2005 Author Share Posted November 10, 2005 thanks , but I want the exact number or percentage. so that i can use operator on the number. say like if cpu usage > 90% then do something ? Link to comment Share on other sites More sharing options...
GaryFrost Posted November 10, 2005 Share Posted November 10, 2005 (edited) Run("taskmgr.exe", "", @SW_HIDE) Sleep(1000) While 1 $rc = StringSplit(StringTrimRight(StatusbarGetText("Windows Task Manager", "", 2), 1), " ") $rc = Int($rc[$rc[0]]) If $rc > 90 Then ; do something MsgBox(4096, "Above 90%", $rc) EndIf Sleep(10) WEnd Edited November 10, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted November 10, 2005 Share Posted November 10, 2005 (edited) if you have beta you could also do: $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") While 1 $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If Int($objItem.LoadPercentage) > 90 Then ; do something here MsgBox(4096, "Above 90%", $objItem.LoadPercentage) Exit EndIf Next Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_Processor") EndIf WEnd Edited November 10, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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