Jump to content
Sign in to follow this  
T3HP0wNz0Rrr

Running for: XTIMEX

Recommended Posts

T3HP0wNz0Rrr

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! :(

Share this post


Link to post
Share on other sites
KaFu

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

_Main()

Func _Main()
    ;Create GUI
    GUICreate("Timer", 120, 50)
    GUICtrlCreateLabel("00:00:00", 10, 10)
    GUISetState()
    ;Start timer
    $timer = TimerInit()
    AdlibRegister("Timer", 50)
    ;
    While 1
        ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before")
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
        ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after")
    WEnd
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

Share this post


Link to post
Share on other sites
T3HP0wNz0Rrr

Thanks! Works like a charm. But how do i multi-process this?

I want to let it tickalong then my bot runs without needing to call the other Timer() func? :(

Share this post


Link to post
Share on other sites
KaFu

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.