Sign in to follow this  
Followers 0
jamesstp20

[Solved]Make a Runtime Timer

4 posts in this topic

#1 ·  Posted (edited)

Hello, I would like to do a timer wich count in Hour:Minute:Second how much time my script is working. I know it's with Timer_Init and Timer_Diff but how :S

Thanks you !

Edited by jamesstp20

Share this post


Link to post
Share on other sites



Try this:

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)

Global $msg
Global $hGUI = GUICreate("Simple Runtime Calculator by UEZ 2011")  ; will create a dialog box that when displayed is centered
Global $label = GUICtrlCreateLabel("", 150, 150,400,400)
GUICtrlSetFont($label, 20, 400)
GUISetState()

Global $seconds = 0

Runtime()
AdlibRegister("Runtime", 1000)

Do
    $msg = GUIGetMsg()
    Sleep(10)
Until $msg = $GUI_EVENT_CLOSE

AdlibUnRegister("Runtime")
GUIDelete($hGUI)
Exit

Func Runtime()
    Local $sec, $min, $hr
    $sec = Mod($seconds, 60)
    $min = Mod($seconds / 60, 60)
    $hr = Floor($seconds / 60 ^ 2)
    GUICtrlSetData($label, StringFormat("%02i:%02i:%02i", $hr, $min, $sec))
    $seconds += 1
EndFunc

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Try this:

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)

Global $msg
Global $hGUI = GUICreate("Simple Runtime Calculator by UEZ 2011")  ; will create a dialog box that when displayed is centered
Global $label = GUICtrlCreateLabel("", 150, 150,400,400)
GUICtrlSetFont($label, 20, 400)
GUISetState()

Global $seconds = 0

Runtime()
AdlibRegister("Runtime", 1000)

Do
    $msg = GUIGetMsg()
    Sleep(10)
Until $msg = $GUI_EVENT_CLOSE

AdlibUnRegister("Runtime")
GUIDelete($hGUI)
Exit

Func Runtime()
    Local $sec, $min, $hr
    $sec = Mod($seconds, 60)
    $min = Mod($seconds / 60, 60)
    $hr = Floor($seconds / 60 ^ 2)
    GUICtrlSetData($label, StringFormat("%02i:%02i:%02i", $hr, $min, $sec))
    $seconds += 1
EndFunc

Br,

UEZ

Thanks You :unsure: !!!!!

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