Jump to content
Sign in to follow this  
ramseier

Startbutton Countdown

Recommended Posts

ramseier

This is a countdown to show when i can go home from work.

Opt("WinTitleMatchMode", 2); Match substring
Opt("TrayIconHide", 1)       ;0=show, 1=hide tray icon
#Include <date.au3>
#include <GuiConstants.au3>

GuiCreate("Startbutton Countdown", 253, 47,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Stunde = GuiCtrlCreateCombo("11", 52, 10, 50, 21)
GUICtrlSetData(-1,"12|13|14|15|16|17|18|19|20|21|22|23|00","17")
$Minute = GuiCtrlCreateCombo("00", 110, 10, 50, 21)
GUICtrlSetData(-1,"05|10|15|20|25|30|35|40|45|50|55","30")
$OK_Button = GuiCtrlCreateButton("OK", 170, 10, 70, 20)
$Label_4 = GuiCtrlCreateLabel("Zielzeit:", 10, 13, 39, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    $Label_4 = $msg
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $OK_Button
      ExitLoop
    Case Else
;;
    EndSelect
WEnd
GUISetState ( @SW_HIDE )
msgbox(0,"Confirm","Die gew├╝nschte Zielzeit ist: "&GUICtrlRead(3)&":"&GUICtrlRead(4))

Global $Sec, $Min, $Hour, $Time
Dim $iHours, $iMins, $iSecs
$count=0
$set="Start"
$EndTicks = _TimeToTicks(GUICtrlRead(3),GUICtrlRead(4),"00")
While 1
$NowTicks = _TimeToTicks(@HOUR,@MIN,@SEC)
$DifTicks = $EndTicks - $NowTicks
if $EndTicks < $NowTicks then Exit
_TicksToTime($DifTicks,$Hour,$Min,$Sec)
if StringLen($Min)< 2 then
    $Min = "0" & $Min
endif
$Time = $Hour & ":" & $Min
ControlSetText ( "", $set, 304, $Time )
ControlSetText ( "", "Start", 304, $Time )
$set = $Time
    Sleep(5000)
ControlSetText ( "", $set, 304, "Start" )
    Sleep(5000)
Wend

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.