jamesstp20 Posted April 23, 2011 Posted April 23, 2011 (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 April 23, 2011 by jamesstp20
Info Posted April 23, 2011 Posted April 23, 2011 $t = TimerInit() For $i = 0 To 5 MsgBox("","",$i) Next ConsoleWrite("Your script has been running for " & TimerDiff($t) & " ms." & @CR)
UEZ Posted April 23, 2011 Posted April 23, 2011 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
jamesstp20 Posted April 23, 2011 Author Posted April 23, 2011 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 !!!!!
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