Jump to content

Timer for program


Recommended Posts

Hello,

Is there a way so you can see how many times a program has started every day and how long it is running?

The program runs at the background and when you start a program you want to log autoit sees it and is counting howmany times it was started and how long.

Save it to a log file everyday updated

i do not know how to start and how can i count ow many times a process is started and how long it is running?

Edited by Erik.

I little problem, hard to find and fix

Link to comment
Share on other sites

Hi,

try to save the information in an ini file. Every time you start, you read the value from the ini and add one then write it back.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thanks, i will take a look.

to record it to a ini file is not so different but i do not know how to record it so you can see how many times it is runing and how long..

Somone an example script?

I little problem, hard to find and fix

Link to comment
Share on other sites

  • 1 month later...

$Writed = 0
 $file = FileOpen("Runned.txt", 1)
 
 While 1
     If ProcessExists("msnmsgr.exe") Then
         If $Writed = 0 Then
             FileWrite($file, @CRLF & @MON & "." & @MDAY & " | " & @HOUR & "." & @MIN & "." & @SEC & "   MSN Started")
             FileClose($file)
             $file = FileOpen("Runned.txt", 1); close and then open? Yes!
             $Writed = 1
         EndIf
     Else
         If $Writed = 1 Then
             FileWrite($file, @CRLF & @MON & "." & @MDAY & " | " & @HOUR & "." & @MIN & "." & @SEC & "   MSN Ended")
             FileClose($file)
             $file = FileOpen("Runned.txt", 1)
             $Writed = 0
         EndIf
     EndIf
 WEnd
 
 FileClose($file)

Edited by kip
Link to comment
Share on other sites

$Writed = 0
   $file = FileOpen("Runned.txt", 1)
   
   While 1
       If ProcessExists("msnmsgr.exe") Then
           If $Writed = 0 Then
               FileWrite($file, @CRLF & @MON & "." & @MDAY & " | " & @HOUR & "." & @MIN & "." & @SEC & "     MSN Started")
               FileClose($file)
               $file = FileOpen("Runned.txt", 1); close and then open? Yes!
               $Writed = 1
           EndIf
       Else
           If $Writed = 1 Then
               FileWrite($file, @CRLF & @MON & "." & @MDAY & " | " & @HOUR & "." & @MIN & "." & @SEC & "     MSN Ended")
               FileClose($file)
               $file = FileOpen("Runned.txt", 1)
               $Writed = 0
           EndIf
       EndIf
   WEnd
   
   FileClose($file)

What's this code for?

If you want timer for how long a program runs for it would be something like:

CODE

$program = ""

If ProcessExists ($program) Then

$programtimer = TimerInit ()

Do

$programexists = ProcessExists ($program)

Until $programexists = 0

$Programtime = TimerDiff ($programtimer)

$hours = Int ($programtimer/3600000)

$minutes = Int(($programtimer-($hours*3600000))/60000)

$seconds = Int(($programtimer-($hours*3600000)-($minutes*60000))/1000)

EndIf

You will have to check the maths for the hours, minutes and seconds and you may want to include

CODE

$msg = GUIGetMsg ()

or

CODE

$msg = TrayGetMsg ()

then change

CODE

Until $programexists = 0

to

CODE

Until $programexists = 0 Or $msg = $close

or something similar to prevent an everlasting loop Edited by Gmail
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...