Jump to content
Sign in to follow this  
FireFox

get start-up time of a process

Recommended Posts

FireFox

How to get how long time the process is running ?

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
GreenFuze

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 - $starttime

Ta-Da!

Share this post


Link to post
Share on other sites
azure

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 by azure

Share this post


Link to post
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
Sign in to follow this  

×