kuebk Posted December 21, 2006 Share Posted December 21, 2006 I want to make countdown timer, from 15:00 [minutes] to 00:00 - and when it reach 00:00 I want sound to be played, could anyone help me with this? Found nothing in help about countdown timer, I want to use it in GUI. Thanks - kuebk. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 21, 2006 Share Posted December 21, 2006 (edited) Timerinit Timerdiff or make a loop that subtracts from 1 from a variable every second and then if it ever equals 1 then subtract one from the minute column and reset the second variable to 60 Edited December 21, 2006 by Thatsgreat2345 Link to comment Share on other sites More sharing options...
kuebk Posted December 21, 2006 Author Share Posted December 21, 2006 Thanks - found them. But I don't really know how to use them and display timer in GUI. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 21, 2006 Share Posted December 21, 2006 i used my other example with the variable and it works pretty good ive made a counter using that method so i know its possible Link to comment Share on other sites More sharing options...
theguy0000 Posted December 21, 2006 Share Posted December 21, 2006 #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 122, 42, 438, 156) $Label1 = GUICtrlCreateLabel("15:00", 8, 8, 43, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $time=TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $new = TimerDiff ($time) $new = (15*60*1000)-$new $seconds = Round ($new/1000) $newMin = Floor ($seconds/60) $newSec = Mod ($seconds, 60) If $newSec < 10 Then $newSec = "0"&$newSec GUICtrlSetData ($Label1, $newMin&":"&$newSec) WEnd handy math functions there The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
onedayillpay Posted December 21, 2006 Share Posted December 21, 2006 maybe you can help me, i need something like this i need a clock and if time = $timetowakeup then play sound... i have been messing around with this script...but i dont understand why it not work #include <Date.au3> Global $Sec, $Min, $Hour, $Time ; calculate with time $StartTicks = _TimeToTicks(@HOUR,@MIN,@SEC) ; calculate 45 minutes later $EndTicks = $StartTicks _TicksToTime($EndTicks,$Hour,$Min,$Sec) MsgBox(262144,'' , 'New Time:' & $Hour & ":" & $Min & ":" & $Sec) MsgBox(0,"time",""&@HOUR&@MIN&@SEC) #include <Date.au3> While 1 Global $Sec, $Min, $Hour, $Time if _TimeToTicks() = "191255" Then ;260000 MsgBox(0,"wake","up") EndIf WEnd Link to comment Share on other sites More sharing options...
Fr3shY Posted December 21, 2008 Share Posted December 21, 2008 No need to include Date.au3 twice And for the sound, into the if statement about when it's complete.. add something like this in:$fileName = FileOpen(beep.wav)SoundPlay($fileName, 0)Change beep.wav to whatever sound file you want....~Fr3shY Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2008 Developers Share Posted December 21, 2008 No need to include Date.au3 twice And for the sound, into the if statement about when it's complete.. add something like this in:Change beep.wav to whatever sound file you want....~Fr3shYNo need to answer an 2 years old question as I doubt they will be waiting for it. Jos 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...
Crazyd Posted September 1, 2011 Share Posted September 1, 2011 I know old topic but I thought I'd add my own sample. Same as above but using a function and Tool Tips. Not sure if it'll show up 100% but what the hell. I did need this information and hope I can help others HotKeySet("{PAUSE}", "TogglePause") fncPauseTime (2, " =================== " & @LF & _ "--- Web page Reload Failed --- " _ & @LF & " --- Forced Pause till next try --- "_ & @LF & " ************************* ", 3) Func fncPauseTime($TimeToPause, $Message, $Warning) Dim $PauseLeft = 1, $Time, $TTLSec, $Sec, $Min $Time = TimerInit() $Paused = Not $Paused While $PauseLeft > 0 And $Paused Sleep(500) $PauseLeft = TimerDiff($Time) $PauseLeft = ($TimeToPause * 60 * 1000) - $PauseLeft $TTLSec = Round($PauseLeft / 1000) $Min = Floor($TTLSec / 60) $Sec = Mod($TTLSec, 60) If $Sec < 10 Then $Sec = "0" & $Sec ToolTip($Message & @LF & " Waiting - " & $Min & ":" & $Sec & " minutes" & @LF & _ "Press {Pause} - to continute.", 400, 30, _ " Paused for " & $TimeToPause & " Minutes", $Warning) WEnd If $Paused Then $Paused = Not $Paused ToolTip("") EndFunc ;==>fncPauseTime Func TogglePause() $Paused = Not $Paused While $Paused ToolTip("************************************" & @CRLF & _ "* Program is Paused *" & @CRLF & _ "************************************" & @CRLF _ , 400, 30, " Paused - Press {Pasue} again" , 2, 0) Sleep(400) WEnd ToolTip("") EndFunc ;==>TogglePause 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