Jump to content
Sign in to follow this  

Countdown Timer with the option to add Time

Recommended Posts

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)

Share this post

Link to post
Share on other sites

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 by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post

Link to post
Share on other sites

Try this:

#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)

Global $countdown = 1 ;minutes for countdown
Global $seconds = $countdown * 60 ;convert to seconds

AdlibRegister("Countdown", 1000)

    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
        Case $button
            $seconds += 3600
Until False


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
        MsgBox(0, "Information", "Countdown reached 00:00:00")
    $seconds -= 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...