Hallo,
ich habe den Timer, den ich schon mal hier gepostet habe, ein wenig verbessert.
AutoIt
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1_1 = GUICreate("Timer", 318, 159, 192, 124)
GUISetBkColor(0x944949)
$Button1 = GUICtrlCreateButton("OK", 248, 103, 50, 50)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)
$Hours = GUICtrlCreateInput("00", 8, 64, 41, 32, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xA0AFF3)
$Minutes = GUICtrlCreateInput("00", 96, 64, 41, 32, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xA0AFF3)
$Seconds = GUICtrlCreateInput("00", 192, 64, 41, 32, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xA0AFF3)
$Label1 = GUICtrlCreateLabel("TIMER", 8, 8, 95, 35)
GUICtrlSetFont(-1, 20, 800, 4, "Times New Roman")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("Timer einstellen:", 8, 48, 86, 17)
$Label3 = GUICtrlCreateLabel("Std.", 56, 72, 35, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Sek.", 240, 72, 51, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label5 = GUICtrlCreateLabel("Min.", 144, 72, 47, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label7 = GUICtrlCreateLabel("Bereit.", 8, 120, 200, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
; Sekunden berechnen
$i = (GUICtrlRead($Hours) * 3600) + (GUICtrlRead($Minutes) * 60) + GUICtrlRead($Seconds)
; Button "kaltstellen", dass kein neuer Timer gesetzt werden kann
GUICtrlSetState($Button1,$GUI_DISABLE)
For $c = $i To 0 Step -1
; Countdown und eine Sekunde Pause.
GUICtrlSetData($Label7, "Timer läuft ("&$c&"s)")
Sleep(1000)
If $c=0 Then
; Timeout mit Zeitstempel anzeigen, falls der Benutzer nicht weiß, wie lange der Timer schon abgelaufen ist.
GUICtrlSetData($Label7, "Timeout ("&@HOUR&":"&@MIN&":"&@SEC&")")
MsgBox(0, "Timeout", "Timeout ("&@HOUR&":"&@MIN&":"&@SEC&")")
; Status auf Bereit setzen und Button "wiederbeleben"
GUICtrlSetData($Label7, "Bereit.")
GUICtrlSetState($Button1,$GUI_ENABLE)
EndIf
Next
EndSwitch
WEnd
Alles anzeigen
Falls wer die EXE-Releases haben will (auf Englisch/Deutsch ist egal, hab jetzt nur die Deutsche Version gepostet), bitte melden.
Nutzungsbedingungen
Spoiler anzeigen
(Das macht dann einen [Blockierte Grafik: http://kaffee.bilderu.de/bilder/kaffee-c-2.jpg] pro Anfrage )
Servus,
Olfibits