Jump to content

Time - Showing Current Time In Gui


Recommended Posts

Is there any command to show the current time (real time) in a GUI - do you have to put it in a while loop while calling the gui? I am at a loss and I have tried to do some searches and have not found what I am looking for, can someone please point me in the right direction.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered
$LabelTime = GUICtrlCreateLabel("", 30, 30, 100)
GUISetState(@SW_SHOW)     ; will display an dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    GUICtrlSetData($LabelTime, @HOUR & ":" & @MIN & ":" & @SEC)
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Link to comment
Share on other sites

this shouldn't have a flicker in it

#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered
$now = @HOUR & ":" & @MIN & ":" & @SEC
$label = GUICtrlCreateLabel($now, 10, 10, 120, 20)
GUISetState(@SW_SHOW)     ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
 $msg = GUIGetMsg()
 If $now <> @HOUR & ":" & @MIN & ":" & @SEC Then
  $now = @HOUR & ":" & @MIN & ":" & @SEC
  GUICtrlSetData($label, $now)
 EndIf
 
 If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

if you want 12 hour clock

#include <GUIConstants.au3>
#include <Date.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered
$now = _DateTimeFormat( _NowCalc(),3)
$label = GUICtrlCreateLabel($now, 10, 10, 120, 20)
GUISetState(@SW_SHOW)     ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
 $msg = GUIGetMsg()
 If $now <> _DateTimeFormat( _NowCalc(),3) Then
  $now = _DateTimeFormat( _NowCalc(),3)
  GUICtrlSetData($label, $now)
 EndIf
 
 If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

this shouldn't have a flicker in it

#include <GUIConstants.au3>

GUICreate("My GUI"); will create a dialog box that when displayed is centered
$now = @HOUR & ":" & @MIN & ":" & @SEC
$label = GUICtrlCreateLabel($now, 10, 10, 120, 20)
GUISetState(@SW_SHOW)    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
 $msg = GUIGetMsg()
 If $now <> @HOUR & ":" & @MIN & ":" & @SEC Then
  $now = @HOUR & ":" & @MIN & ":" & @SEC
  GUICtrlSetData($label, $now)
 EndIf
 
 If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Thanks - did I miss is anywhere. I would like to read more on it. And that way also find more information on the macros. I find see them in the help section but it does not show you where to use it or how, or does that just come with knowledge. Thanks again for you quick help and time. You guys really are the best.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Thanks - did I miss is anywhere. I would like to read more on it. And that way also find more information on the macros. I find see them in the help section but it does not show you where to use it or how, or does that just come with knowledge. Thanks again for you quick help and time. You guys really are the best.

Time and experience

yw

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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