Jump to content

Startbutton Countdown


ramseier
 Share

Recommended Posts

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
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...