Jump to content

Counter (wm 2006)


Recommended Posts

Hi,

just bored and played a little bit around.

#include<Date.au3>
HotKeySet("{esc}", "end")

While 1
    ToolTip("WM 2006 Kickoff" & @CRLF & "============" & @CRLF & _counter("2006/06/09", "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

Edited by th.meger

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

Link to comment
Share on other sites

Cute...

however, reflects "-8" hours???

8)

HI,

that happens when I post untested scripts. :( I wrote it completely new. Hope it works better now. :D

So long,

Mega

P.S.: Maybe I can make an udf return days, hours, minuntes, sec & msec left out of it :)

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...