Jump to content
Sign in to follow this  


Recommended Posts


I have a window

$hours = GUICtrlRead($Input1ausin)
                $mins = GUICtrlRead($Input2ausin)
                $secs = 00
                If $mins <= 60 AND $mins >= 0 Then
                    Global $Form4 = GUICreate("Countdown", 263, 153)
                    $Labelcount = GUICtrlCreateLabel($hours, 81, 39, 28, 36, $SS_CENTER)
                    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
                    $Label1count = GUICtrlCreateLabel($mins, 120, 40, 28, 36, $SS_CENTER)
                    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
                    $Label2count = GUICtrlCreateLabel($secs, 160, 40, 28, 36, $SS_CENTER)
                    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
                    $Label3count = GUICtrlCreateLabel(":", 112, 37, 7, 36)
                    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
                    $Label4count = GUICtrlCreateLabel(":", 152, 37, 7, 36)
                    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
                    Global $Buttoncount = GUICtrlCreateButton("Cancel", 83, 104, 97, 25)
                   MsgBox(0, "Error", "Invalid time")

And i want to start the countdown as soon as the window is created, and count down every second. When the countdown is finished, it should do something, and when $Buttoncount is pressed, it should simply exit the code.

Share this post

Link to post
Share on other sites


I suggest you search for "countdown" - the search box is at top-right - as there are multiple threads about this simple process on the forum. :)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

Take a look here:

$ms = 300000
$timer = TimerInit()
$labeltext = "Count down test"
GUICreate("Count down test", 350, 330, -1, -1)
$Exit = GUICtrlCreateButton("Exit now", 100, 250, 150, 50)
$Label = GUICtrlCreateLabel($labeltext, 10, 10, 330, 200)
$Input = GUICtrlCreateInput("", 140, 225, 75, 20)

While (TimerDiff($timer) < $ms) And (GUIGetMsg() <> $Exit)
    $seconds = TimerDiff($timer) / 1000
    $diff = $seconds - ($ms / 1000)
    $minutes = Int($diff / 60)
    $secondsRem = $diff - ($minutes * 60)
    $minutes = $minutes * - 1
    $secondsRem = $secondsRem * - 1
    $time = StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem)
    GUICtrlSetData($Input, $time)


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

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