Jump to content

Time question


Recommended Posts

I'm trying to add the system time to a gui.

It would look something like

Current Time _______

Time Left _________ <<< this part I'm sure is easy to figure out.

I have tried the timenow() and Now() but what I am wanting is for it to update to the sec.

Any ideas on where I can find the info? Or can it even be done?

Thanks

Cue

Edited by cueclub
Link to comment
Share on other sites

cueclub,

Now() gives you a second count. It's not clear what you actually want. AutoIT has a lot of very useful time functions and I've used a lot them. Are you looking for to have the time update every second? If so, can your program sleep for a second? If not, a timer would be the go.

Regards,

Mike H

Link to comment
Share on other sites

Well i guess i should have explained it a little better. I want to add a running clock with the current time. not just a time stamp.

And then under it I will have a countdown timer. Showing how much time is remaining.

I'm wanting to add it to a math test program I am writing for my son. It will give him a set amount of time to finish so many math problems.

But I wasn't sure how to go about adding the running clock. Yes i know there is a clock on the computer, but i want his focus to be entirely on 1 area.

Thanks

Cue

Link to comment
Share on other sites

One way...

#include <Date.au3>
#include <Timers.au3>
#include <GuiConstantsEx.au3>

$hGUI = GUICreate("Timers", 400, 320)
$label_time = GUICtrlCreateLabel(_Now(), 10, 10, 300)
GUISetState(@SW_SHOW)

$timer_clock = _Timer_SetTimer($hGUI, 1000, "_UpdateClock") ; create timer

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

_Timer_KillTimer($hGUI, $timer_clock)

Func _UpdateClock($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($label_time, _Now())
EndFunc   ;==>_UpdateClock
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...