Erik. Posted May 13, 2007 Share Posted May 13, 2007 (edited) 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 May 13, 2007 by Erik. I little problem, hard to find and fix Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 13, 2007 Share Posted May 13, 2007 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 More sharing options...
Valuater Posted May 13, 2007 Share Posted May 13, 2007 These may help...http://www.autoitscript.com/forum/index.ph...st&p=322092http://www.autoitscript.com/forum/index.ph...st&p=3369768) Link to comment Share on other sites More sharing options...
Erik. Posted May 13, 2007 Author Share Posted May 13, 2007 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 More sharing options...
erebus Posted May 13, 2007 Share Posted May 13, 2007 (edited) Add this on top of your script: $timesrun = IniRead("settings.ini", "MyProg", "TimesRun", "0") $timesrun = $timesrun + 1 IniWrite("settings.ini", "MyProg", "TimesRun", $timesrun) Edited May 13, 2007 by erebus Link to comment Share on other sites More sharing options...
Erik. Posted May 13, 2007 Author Share Posted May 13, 2007 Whit that you can se ehow many times the script has been running? I need to know how many time the program is running like, msn.exe I little problem, hard to find and fix Link to comment Share on other sites More sharing options...
erebus Posted May 13, 2007 Share Posted May 13, 2007 Use $timesrun -- it will always has the exact number the program has been executed. Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Share Posted June 21, 2007 if you still want this, use TimerInit () and TimerDiff ( timestamp ) then start the timer when the process starts and get the TimerDiff when the process closes Deal or No Deal? Link to comment Share on other sites More sharing options...
Erik. Posted June 21, 2007 Author Share Posted June 21, 2007 Oh lol thanks... I am now busy whit another program i will take a look I little problem, hard to find and fix Link to comment Share on other sites More sharing options...
Kip Posted June 21, 2007 Share Posted June 21, 2007 (edited) $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 June 21, 2007 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Share Posted June 21, 2007 (edited) $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 June 21, 2007 by Gmail Deal or No Deal? Link to comment Share on other sites More sharing options...
Valuater Posted June 21, 2007 Share Posted June 21, 2007 add two lines to the top and 4 lines to the bottom of any program #include <file.au3> _FileWriteLog("Run-Log.txt", "StY ][ÝÊBÈ[ÝØÜB[ÈÛ]]Ú]^] BÑ[UÜ]SÙÊ V÷Cµ'VâÔÆörçGBgV÷C²ÂgV÷C´fæ6VBgV÷C²fײ5$Äb¢W@¤VæDgVæ0 8) 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