Jump to content

[Solved]Make a Runtime Timer


Recommended Posts

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

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