Jump to content

Running for: XTIMEX

Recommended Posts

Hey all,

I have a new question:

I want my bot to show the total time he's running.

I got @MIN, @SEC and @HOUR declared in the start of the program.

Now, i want my bot to update every second the time it is, and display the total time it is running for.

Example: Started at 21:24:36, and now it is 21:34:36; he must display:

"Running for: 0:10:0" or something like that.

If someone can give me the code, THANKS! :(

Link to comment
Share on other sites

Help-File example for the _TicksToTime() UDF.

; *** Demo to show a timer window
#include <GUIConstantsEx.au3>
#include <Date.au3>

Opt("TrayIconDebug", 1)

Opt("MustDeclareVars", 1)

Global $timer, $Secs, $Mins, $Hour, $Time


Func _Main()
    ;Create GUI
    GUICreate("Timer", 120, 50)
    GUICtrlCreateLabel("00:00:00", 10, 10)
    ;Start timer
    $timer = TimerInit()
    AdlibRegister("Timer", 50)
    While 1
        ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before")
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
        ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after")
EndFunc   ;==>_Main
Func Timer()
    _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs)
    Local $sTime = $Time  ; save current time to be able to test and avoid flicker..
    $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
EndFunc   ;==>Timer
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...