Darkonen Posted September 17, 2005 Share Posted September 17, 2005 I'd like to create a chronometer program but i do't now how to update a dialog and with control is the best for doing it, Any suggestions!!! Thnx Link to comment Share on other sites More sharing options...
Darkonen Posted September 18, 2005 Author Share Posted September 18, 2005 Anyone knows how to show time in a dialog box?? Link to comment Share on other sites More sharing options...
Developers Jos Posted September 18, 2005 Developers Share Posted September 18, 2005 (edited) Posted a while ago here, maybe that helps?:#include <GUIConstants.au3> #include <Date.au3> opt("TrayIconDebug",1) Global $Secs, $Mins, $Hour, $Time ;Create GUI GUICreate("My Timer", 200, 200) GUICtrlCreateLabel("00:00:00", "80", "80") GUISetState() ;Start timer $timer = TimerInit() AdlibEnable("Timer", 50) ; While 1 ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before") $msg = GUIGetMsg() ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after") Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect Wend ; 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("My Timer", "", "Static1", $Time) EndFunc;==>Timer Edited September 18, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Westi Posted September 18, 2005 Share Posted September 18, 2005 A simple clock:#Include <Date.au3> #include <GUIConstants.au3> AdlibEnable ( "_time" , 1000 ) GUICreate( "Watch", 100, 30, -1, -1, $WS_Caption, $WS_EX_TOPMOST ) $Clock = GUICtrlCreateLabel( "Watch", 10, 10, 50 ) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE then _Exit();ESC to exit WEnd Func _time() GUICtrlSetData ( $Clock, _NowTime(5) ) EndFunc Func _Exit() GUIDelete() Exit EndFuncA simple stopwatch#include <GUIConstants.au3> #include <Date.au3> Dim $Ver = "Stopwatch" HotKeySet( "!x", "_Exit" );Alt+X to exit GUICreate( $Ver, 100, 30, -1, -1, $WS_Caption, $WS_EX_TOPMOST ) $Clock = GUICtrlCreateLabel( $Ver, 25, 10, 50 ) GUISetState() For $i = 0 To 86400; max. 24h $Time = _DateAdd ( "s", $i, "2000/01/01 00:00:00" ) $Dif = StringSplit ( $Time, " " ) GUICtrlSetData ( $Clock, $Dif[2] ) Sleep( 1000 ) Next Func _Exit() MsgBox( 16, $Ver, " stopped at:" & @LF & $Dif[2], 5 ) GUIDelete() Exit EndFunc Link to comment Share on other sites More sharing options...
BigDod Posted September 18, 2005 Share Posted September 18, 2005 Here is another one with an alarm function. I can't remember who wrote it but it was not me. expandcollapse popup#include <GuiConstants.au3> Global $sec = @SEC, $minute, $hour, $light, $time, $clocklabel opt("WinWaitDelay", 100) opt("WinTitleMatchMode", 4) opt("WinDetectHiddenText", 1) opt("MouseCoordMode", 0) GUICreate("Max's Clock", 200, 50, (@DesktopWidth - 188) / 2, (@DesktopHeight - 59) / 2) $clocklabel = GUICtrlCreateLabel("Loading...", 5, 5, 190, 40, 0x1000) GUICtrlSetFont($clocklabel, 24) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop ElseIf $sec <> @SEC Then GUICtrlSetData($clocklabel, TimeSet()) AlarmCheck(TimeSet()) EndIf WEnd Exit Func AlarmCheck($time) If $time = "6:10:00 PM"Then MsgBox(0,"","Alarm Message");Alarm function(configure how wanted) EndIf EndFunc ;==>AlarmCheck Func TimeSet() $light = " AM" $hour = @HOUR $minute = @MIN $sec = @SEC If $hour = 0 Then $hour = 12 ElseIf $hour = 12 Then $light = " PM" ElseIf $hour > 12 Then $hour = (@HOUR) - 12 $light = " PM" EndIf $time = $hour & ":" & $minute & ":" & $sec & $light Return $time EndFunc ;==>TimeSet Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
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