BrettF Posted October 5, 2006 Share Posted October 5, 2006 Is there any way to have a count down without doing the following methods? MsgBox (0, "Get Ready!", "You have 10 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 9 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 8 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 7 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 6 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 5 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 4 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 3 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "You have 2 seconds remaining. Goof luck!", 1) MsgBox (0, "Get Ready!", "GO!", 1)oÝ÷ ØäZºÚ"µÍÜ ÌÍÚHHLÈHÝLBÙÐÞ ][ÝÑÙ]XYIÌÌÎÉ][ÝË ][ÝÖ[ÝH]H ][ÝÈ [È ÌÍÚH [È ][ÝÈÙXÛÛÈ[XZ[[ËB^ÙÐÞ ][ÝÑÙ]XYIÌÌÎÉ][ÝË ][ÝÑÓÉÌÌÎÉ][ÝÊ Really. what i want it to do is count down in the same window and without opening a new one. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
cppman Posted October 5, 2006 Share Posted October 5, 2006 (edited) ;Sample countdown timer. Counts down from 10 seconds. Global $nTime = 10 AdLibEnable("CountDown", 1000) ;1000 MSeconds = 1 Second While 1 sleep(10) if ($nTime == 0) Then MsgBox(0, "", "Times up!!") AdLibDisable() EndIf Wend Func CountDown() $nTime -= 1 EndFunc Edited October 5, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
BrettF Posted October 5, 2006 Author Share Posted October 5, 2006 ;Sample countdown timer. Counts down from 10 seconds. Global $nTime = 10 AdLibEnable("CountDown", 1000) While 1 sleep(10) if ($nTime == 0) Then MsgBox(0, "", "Times up!!") AdLibDisable() EndIf Wend Func CountDown() $nTime -= 1 EndFunc Its kinda wat i wanted. I whant the user to see the count down. Any ideas Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
cppman Posted October 5, 2006 Share Posted October 5, 2006 (edited) All ya gotta do is add a GUI to it ;Sample countdown timer. Counts down from 10 seconds. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Count Down", 296, 64, 193, 115) $Label1 = GUICtrlCreateLabel("Time Remaining: ", 6, 21, 86, 17) $Label2 = GUICtrlCreateLabel("time", 101, 22, 23, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $nTime = 10 AdLibEnable("CountDown", 1000) While (GUIGetMsg() <> -3) sleep(10) if ($nTime <> -1) Then GUICtrlSetData($Label2, $nTime) EndIf if ($nTime == 0) Then $nTime -= 1 MsgBox(0, "", "Times up!!") AdLibDisable() EndIf Wend Func CountDown() $nTime -= 1 EndFunc Edited October 5, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
BrettF Posted October 5, 2006 Author Share Posted October 5, 2006 All ya gotta do is add a GUI to it ;Sample countdown timer. Counts down from 10 seconds. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Count Down", 296, 64, 193, 115) $Label1 = GUICtrlCreateLabel("Time Remaining: ", 6, 21, 86, 17) $Label2 = GUICtrlCreateLabel("time", 101, 22, 23, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $nTime = 10 AdLibEnable("CountDown", 1000) While (GUIGetMsg() <> -3) sleep(10) if ($nTime <> -1) Then GUICtrlSetData($Label2, $nTime) EndIf if ($nTime == 0) Then $nTime -= 1 MsgBox(0, "", "Times up!!") AdLibDisable() EndIf Wend Func CountDown() $nTime -= 1 EndFunc Thanks Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 5, 2006 Share Posted October 5, 2006 Hi, #include<Date.au3> HotKeySet("{esc}", "end") ; "YYYY/MM/DD[ HH:MM:SS]" While 1 ToolTip("Date" & @CRLF & "============" & @CRLF & _counter("2006/10/12", "18:00:00") & " left", _ @DesktopWidth - 100, 30) Sleep(1) WEnd ; "YYYY/MM/DD[ HH:MM:SS]" Func _counter($s_Date, $s_time) If _DateIsValid($s_Date & " " & $s_time) Then Local $NumberOfSeconds = _DateDiff("s", _NowCalc(), $s_Date & " " & $s_time) Return StringFormat("Days = %.02d" & @CRLF & "Hours = %.02d" & @CRLF & "Min = %.02d" & @CRLF & "Sec = %.02d" & @CRLF & _ "Msec = %.03d", $NumberOfSeconds / 86400, Mod($NumberOfSeconds / 3600, 24), Mod(($NumberOfSeconds / 60), 60), _ Mod($NumberOfSeconds, 60), 1000 - _MSec()) Else Return -1 EndIf EndFunc ;==>_counter Func _MSec() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 Return $sMilliSeconds EndFunc ;==>_MSec Func end() Exit (0) EndFunc ;==>end So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
BrettF Posted October 5, 2006 Author Share Posted October 5, 2006 Hi, #include<Date.au3> HotKeySet("{esc}", "end") ; "YYYY/MM/DD[ HH:MM:SS]" While 1 ToolTip("Date" & @CRLF & "============" & @CRLF & _counter("2006/10/12", "18:00:00") & " left", _ @DesktopWidth - 100, 30) Sleep(1) WEnd ; "YYYY/MM/DD[ HH:MM:SS]" Func _counter($s_Date, $s_time) If _DateIsValid($s_Date & " " & $s_time) Then Local $NumberOfSeconds = _DateDiff("s", _NowCalc(), $s_Date & " " & $s_time) Return StringFormat("Days = %.02d" & @CRLF & "Hours = %.02d" & @CRLF & "Min = %.02d" & @CRLF & "Sec = %.02d" & @CRLF & _ "Msec = %.03d", $NumberOfSeconds / 86400, Mod($NumberOfSeconds / 3600, 24), Mod(($NumberOfSeconds / 60), 60), _ Mod($NumberOfSeconds, 60), 1000 - _MSec()) Else Return -1 EndIf EndFunc ;==>_counter Func _MSec() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 Return $sMilliSeconds EndFunc ;==>_MSec Func end() Exit (0) EndFunc ;==>end So long, Mega Thats really really awsome. Thanks but chris had the right type of countdown that i wanted I sown got to do a date countdown using that Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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