Reinhardt1julian Posted March 2, 2013 Posted March 2, 2013 I have a window $hours = GUICtrlRead($Input1ausin) $mins = GUICtrlRead($Input2ausin) $secs = 00 If $mins <= 60 AND $mins >= 0 Then GUIDelete($Form3) 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) GUISetState(@SW_SHOW) Else MsgBox(0, "Error", "Invalid time") EndIf ExitLoop 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.
Moderators Melba23 Posted March 2, 2013 Moderators Posted March 2, 2013 Reinhardt1julian,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. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Nessie Posted March 2, 2013 Posted March 2, 2013 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) GUISetState(@SW_SHOW) 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) ; WEnd Exit 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
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