Sign in to follow this  
Followers 0
BrettF

Count Down

7 posts in this topic

Is there any way to have a count down without doing the following methods?

MsgBox (0, "Get Ready!", "You have 10 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 9 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 8 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 7 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 6 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 5 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 4 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 3 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "You have 2 seconds remaining.  Goof luck!", 1) 
    MsgBox (0, "Get Ready!", "GO!", 1)oÝ÷ ØäZºÚ"µÍÜ    ÌÍÚHHLÈHÝLBÙÐÞ
    ][ÝÑÙ]XYIÌÌÎÉ][ÝË  ][ÝÖ[ÝH]H    ][ÝÈ  [È ÌÍÚH [È ][ÝÈÙXÛÛÈ[XZ[[ËB^ÙÐÞ
    ][ÝÑÙ]XYIÌÌÎÉ][ÝË  ][ÝÑÓÉÌÌÎÉ][ÝÊ

Really. what i want it to do is count down in the same window and without opening a new one.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

;Sample countdown timer. Counts down from 10 seconds.
Global $nTime = 10
AdLibEnable("CountDown", 1000) ;1000 MSeconds = 1 Second
While 1
    sleep(10)
    if ($nTime == 0) Then 
       MsgBox(0, "", "Times up!!")
       AdLibDisable()
    EndIf
Wend
Func CountDown()
        $nTime -= 1
EndFunc

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

;Sample countdown timer. Counts down from 10 seconds.
Global $nTime = 10
AdLibEnable("CountDown", 1000)
While 1
    sleep(10)
    if ($nTime == 0) Then 
       MsgBox(0, "", "Times up!!")
       AdLibDisable()
    EndIf
Wend
Func CountDown()
        $nTime -= 1
EndFunc
Its kinda wat i wanted. I whant the user to see the count down. Any ideas

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

All ya gotta do is add a GUI to it :lmao:

;Sample countdown timer. Counts down from 10 seconds.
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Count Down", 296, 64, 193, 115)
$Label1 = GUICtrlCreateLabel("Time Remaining: ", 6, 21, 86, 17)
$Label2 = GUICtrlCreateLabel("time", 101, 22, 23, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $nTime = 10
AdLibEnable("CountDown", 1000)
While (GUIGetMsg() <> -3)
    sleep(10)
    if ($nTime <> -1) Then
        GUICtrlSetData($Label2, $nTime)
    EndIf
    if ($nTime == 0) Then
        $nTime -= 1
       MsgBox(0, "", "Times up!!")
       AdLibDisable()
    EndIf
Wend
Func CountDown()
        $nTime -= 1
EndFunc
Edited by CHRIS95219

Share this post


Link to post
Share on other sites

All ya gotta do is add a GUI to it :lmao:

;Sample countdown timer. Counts down from 10 seconds.
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Count Down", 296, 64, 193, 115)
$Label1 = GUICtrlCreateLabel("Time Remaining: ", 6, 21, 86, 17)
$Label2 = GUICtrlCreateLabel("time", 101, 22, 23, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $nTime = 10
AdLibEnable("CountDown", 1000)
While (GUIGetMsg() <> -3)
    sleep(10)
    if ($nTime <> -1) Then
        GUICtrlSetData($Label2, $nTime)
    EndIf
    if ($nTime == 0) Then
        $nTime -= 1
       MsgBox(0, "", "Times up!!")
       AdLibDisable()
    EndIf
Wend
Func CountDown()
        $nTime -= 1
EndFunc
Thanks

Share this post


Link to post
Share on other sites

Hi,

#include<Date.au3>
HotKeySet("{esc}", "end")
; "YYYY/MM/DD[ HH:MM:SS]"
While 1
    ToolTip("Date" & @CRLF & "============" & @CRLF & _counter("2006/10/12", "18:00:00") & " left", _
            @DesktopWidth - 100, 30)
    Sleep(1)
WEnd

; "YYYY/MM/DD[ HH:MM:SS]"
Func _counter($s_Date, $s_time)
    If _DateIsValid($s_Date & " " & $s_time) Then
        Local $NumberOfSeconds = _DateDiff("s", _NowCalc(), $s_Date & " " & $s_time)
        Return StringFormat("Days   = %.02d" & @CRLF & "Hours   = %.02d" & @CRLF & "Min = %.02d" & @CRLF & "Sec = %.02d" & @CRLF & _
                "Msec   = %.03d", $NumberOfSeconds / 86400, Mod($NumberOfSeconds / 3600, 24), Mod(($NumberOfSeconds / 60), 60), _
                Mod($NumberOfSeconds, 60), 1000 - _MSec())
    Else
        Return -1
    EndIf
EndFunc   ;==>_counter

Func _MSec()
    Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
    DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
    $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))
    $stSystemTime = 0
    Return $sMilliSeconds
EndFunc   ;==>_MSec

Func end()
    Exit (0)
EndFunc   ;==>end

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

#include<Date.au3>
HotKeySet("{esc}", "end")
; "YYYY/MM/DD[ HH:MM:SS]"
While 1
    ToolTip("Date" & @CRLF & "============" & @CRLF & _counter("2006/10/12", "18:00:00") & " left", _
            @DesktopWidth - 100, 30)
    Sleep(1)
WEnd

; "YYYY/MM/DD[ HH:MM:SS]"
Func _counter($s_Date, $s_time)
    If _DateIsValid($s_Date & " " & $s_time) Then
        Local $NumberOfSeconds = _DateDiff("s", _NowCalc(), $s_Date & " " & $s_time)
        Return StringFormat("Days   = %.02d" & @CRLF & "Hours   = %.02d" & @CRLF & "Min = %.02d" & @CRLF & "Sec = %.02d" & @CRLF & _
                "Msec   = %.03d", $NumberOfSeconds / 86400, Mod($NumberOfSeconds / 3600, 24), Mod(($NumberOfSeconds / 60), 60), _
                Mod($NumberOfSeconds, 60), 1000 - _MSec())
    Else
        Return -1
    EndIf
EndFunc   ;==>_counter

Func _MSec()
    Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
    DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
    $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))
    $stSystemTime = 0
    Return $sMilliSeconds
EndFunc   ;==>_MSec

Func end()
    Exit (0)
EndFunc   ;==>end

So long,

Mega

Thats really really awsome.

Thanks but chris had the right type of countdown that i wanted

I sown got to do a date countdown using that

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  
Followers 0