mcgill Posted April 27, 2011 Share Posted April 27, 2011 Looking for a countdown timer to be used with applying certain installations prior to reaching zero/no time left. I am not looking for a countup function. With this function I would like to be able to add time to it incase a user wants to increase the countdown timer, example being countdown timer of 60 minutes/1 hour, user wants to increase by 60 minutes/1 hour. The only information I have come across on the forums is for minutes and seconds only. Any helps/assistance in the right direction would be great, thanks Example on forums: ******************* $new = TimerDiff ($timer) $new = (60*60*1000)-$new $seconds = Round ($new/1000) $newMin = Floor ($seconds/60) $newSec = Mod ($seconds, 60) If $newSec < 10 Then $newSec = "0"&$newSec $LabelTime = $newMin & ":" & $newSec GUICtrlSetData ($TimeLimit, $LabelTime) Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 27, 2011 Share Posted April 27, 2011 (edited) Search the Example Scripts forum with the keywords countdown timer. I'm sure thru the lengthy results page you'll find several posts that help you out. Edited April 27, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
UEZ Posted April 28, 2011 Share Posted April 28, 2011 Try this: expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $msg Global $hGUI = GUICreate("Simple Countdown by UEZ 2011", 350, 150) Global $label = GUICtrlCreateLabel("", 30, 30, 260, 80) ;~ GUICtrlSetBkColor(-1, 0x808080) GUICtrlSetFont(-1, 50, 400) Global $button = GUICtrlCreateButton("Add 1h", 295, 120, 50) GUISetState() Global $countdown = 1 ;minutes for countdown Global $seconds = $countdown * 60 ;convert to seconds Countdown() AdlibRegister("Countdown", 1000) Do $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $button $seconds += 3600 EndSwitch Until False AdlibUnRegister("Countdown") GUIDelete($hGUI) Exit Func Countdown() Local $sec, $min, $hr $sec = Mod($seconds, 60) $min = Mod($seconds / 60, 60) $hr = Floor($seconds / 60 ^ 2) GUICtrlSetData($label, StringFormat("%02i:%02i:%02i", $hr, $min, $sec)) If $seconds <= 0 Then AdlibUnRegister("Countdown") MsgBox(0, "Information", "Countdown reached 00:00:00") Exit EndIf $seconds -= 1 EndFunc Br, UEZ mesale0077 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
JScript Posted April 28, 2011 Share Posted April 28, 2011 @UEZ Nice example! You're awesome... http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
mcgill Posted April 28, 2011 Author Share Posted April 28, 2011 Thank you UEZ, your assistance is much appreciated. 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