FireFox Posted January 14, 2009 Share Posted January 14, 2009 How to get how long time the process is running ? Cheers, FireFox. Link to comment Share on other sites More sharing options...
GreenFuze Posted January 14, 2009 Share Posted January 14, 2009 Just an out of the top of my head:IF you want to check a windows form application:find out how to get the current tick count (C++'s GetCurrentTickCount()) (I'm new in auto it, so I don't really know how to do that :-) ).and do something like that:$starttime = GetCurrentTickCount()Run($app)WinWaitActive("title") // p.s. I wonder how you can perform this without using title but HWND$endtime = GetCurrentTickCount()$timeInms = $endtime - $starttimeTa-Da! Link to comment Share on other sites More sharing options...
azure Posted January 14, 2009 Share Posted January 14, 2009 (edited) How to get how long time the process is running ? Cheers, FireFox. $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colProcessList = $objWMIService.ExecQuery("Select * from Win32_Process where Name = 'cmd.exe'") For $objProcess In $colProcessList ConsoleWrite(WMIDateStringToDate($objProcess.CreationDate)&@CRLF) Next Func WMIDateStringToDate($dtmStart) $temp = StringMid($dtmStart, 5, 2) & "/" & StringMid($dtmStart, 7, 2) & "/" & StringLeft($dtmStart, 4) & " " & StringMid($dtmStart, 9, 2) & ":" & StringMid($dtmStart, 11, 2) & ":" & StringMid($dtmStart, 13, 2) Return $temp EndFuncoÝ÷ Ù8b²ÈhºW`zܨºËZ®×"ÚÞ¶êç²Ø^²Ö«µÖ{ûbêjèqë,{aDZàEÄ62¢èî²ÙÞyÛh²æí§-¶¶)~º&4åÊv÷öÛay-+"³Z·*.Á©íyÖî¶w¶z'zØ^ë,jëh×6$strComputer = "." $objWMIService = ObjGet("winmgmts:\\"&$strComputer&"\root\cimv2") $objEventSource = $objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceOperationEvent WITHIN 5 WHERE TargetInstance ISA 'Win32_Process'") While 1 $objEventObject = $objEventSource.NextEvent() If StringRight($objEventObject.TargetInstance.Name, 4) = ".exe" Then Select Case $objEventObject.Path_.Class = "__InstanceCreationEvent" ConsoleWrite($objEventObject.TargetInstance.Name & " started: " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF) Case $objEventObject.Path_.Class = "__InstanceDeletionEvent" ConsoleWrite($objEventObject.TargetInstance.Name & " ended: " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF) EndSelect EndIf WEnd This will show you when things start and stop.. basically monitoring your processes for whatever (i'm searching for ".exe") Edited January 14, 2009 by azure 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