Vegar Posted December 31, 2008 Share Posted December 31, 2008 Hello... I'm making a small program, and i'm making a som statistics/Log for the program just for fun... and i wantet to make a counter that says your "Total Running Time"... so you can check how long the program have been running total... Link to comment Share on other sites More sharing options...
enaiman Posted December 31, 2008 Share Posted December 31, 2008 Top of your script: $RunningTime = TimerInit() End of your script (before exit) MsgBox(0, "Running Time", TimerDiff($RunningTime)/1000&" seconds") You better start reading the Help file Leendert-Jan 1 SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Vegar Posted December 31, 2008 Author Share Posted December 31, 2008 yeah this is for how long the program has been running since i started it.... but i want TOTAL running time.... so the the running time total for evry time the program has been used.. and yeah i've tried look in the help file.... Link to comment Share on other sites More sharing options...
DangerousDan Posted December 31, 2008 Share Posted December 31, 2008 you'd have to create a file to store the data, wouldn't you? $RunningTime = TimerInit() $datafile=fileopen(...) $prevruntime=filereadline(...) ...add data filewriteline(new run time total) you could also use the ini functions and create an ini file... Link to comment Share on other sites More sharing options...
Vegar Posted January 1, 2009 Author Share Posted January 1, 2009 hmm.. i tired but did not get it to work ... but then again i'm kindoff a noob with autoit so could someone tell me where in this script i shall put in the code that DangerousDan sendt me. #include <GuiConstants.au3> $itimerdiff = TimerInit() GuiCreate("Sample GUI", 400, 400) $Knapp_1 = GuiCtrlCreateButton("Knapp", 160, 160, 100, 30) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Knapp_1 MsgBox(0, "Running Time", TimerDiff($itimerdiff)/1000&" seconds") EndSelect Wend GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd just make some example file thnx Link to comment Share on other sites More sharing options...
DangerousDan Posted January 1, 2009 Share Posted January 1, 2009 (edited) I posted a suggestion, not usable code. the code below does what you are asking, I'm a n00b too so don't expect it to be the best or easiest way... change the file location to suit your needs before running. you can use an ini file to keep all kinds of information. specific to time keeping you can have sections, keys, and values for years, months, days etc. totals. #include <GuiConstants.au3> $itimerdiff = TimerInit() GuiCreate("Sample GUI", 400, 400) $Knapp_1 = GuiCtrlCreateButton("Knapp", 160, 160, 100, 30) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Knapp_1 MsgBox(0, "Running Time", TimerDiff($itimerdiff)/1000&" seconds") EndSelect Wend $runtime=TimerDiff($itimerdiff)/1000;in seconds $currenttotal=IniRead("d:\test\test.ini","RunTime","Total","");reads previous entry, if applicable if not IsNumber($currenttotal) then $currenttotal=0;checks for validity $newtotal=$currenttotal+$runtime;adds old time and new time together iniwrite("d:\test\test.ini","RunTime","Total",$newtotal);writes new time, creates file if necessary Edited January 1, 2009 by DangerousDan 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