Sign in to follow this  
Followers 0
Vegar

"Total Running Time" for a program ...(GUInewbe)...

6 posts in this topic

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...

Share this post


Link to post
Share on other sites



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 :)


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 :)

Share this post


Link to post
Share on other sites

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.... :)

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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 :o

thnx :D

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by DangerousDan

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  
Followers 0