Jump to content

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


Vegar
 Share

Recommended Posts

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

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

Link to comment
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.... :)

Link to comment
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

Link to comment
Share on other sites

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