Hallo,
ich habe mit AutoIt einen kleinen Timer programmiert, weiß nicht ob das schon jemand gemacht hat, aber egal.
GUI mit KODA, ist glaube ich selbsterklärend.
Der Code funktioniert so:
- Ich berechne die Summe aus den eingegebenen Stunden mal 3600, den Minuten mal 60 und den Sekunden und multipliziere diese mit 1000.
- Diese Zahl bildet das Argument für Sleep( milliseconds )
- Danach kommen im 200-Millisekunden-Abstand zwei kurze Piepser, in der Statuszeile die Nachricht "Status: Timeout" und anschließend eine Message-Box mit dem Inhalt "TIME OUT!!"
Gleichzeitiges MessageBox-Öffnen und Piepen habe ich noch nicht gemacht, aber das ist ja vielleicht mal etwas.
Oder etwa nicht...
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("Timer", 210, 89, 192, 124)
$Label1 = GUICtrlCreateLabel("Select time (format: HH:MM:SS)", 8, 8, 154, 17)
$Label2 = GUICtrlCreateLabel(":", 50, 44, 7, 17)
$Label3 = GUICtrlCreateLabel(":", 98, 44, 7, 17)
$Button1 = GUICtrlCreateButton("Go", 152, 39, 43, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)
$Input1 = GUICtrlCreateInput("00", 8, 40, 41, 21)
$Input2 = GUICtrlCreateInput("00", 56, 40, 41, 21)
$Input3 = GUICtrlCreateInput("00", 104, 40, 41, 21)
$Label4 = GUICtrlCreateLabel("Status: Ready.", 0, 72, 210, 17)
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
$Label4 = GUICtrlCreateLabel("Status: Timer running.", 0, 72, 210, 17)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$h = Int(GUICtrlRead($Input1))
$m = Int(GUICtrlRead($Input2))
$s = Int(GUICtrlRead($Input3))
Sleep(1000*($h*3600+$m*60+$s))
$Label4 = GUICtrlCreateLabel("Status: Timeout.", 0, 72, 210, 17)
GUICtrlSetBkColor(-1, 0xC0C0C0)
Beep(500, 200)
Sleep(20)
Beep(500, 200)
MsgBox(0,"Timeout","TIME OUT!")
$Label4 = GUICtrlCreateLabel("Status: Ready.", 0, 72, 210, 17)
GUICtrlSetBkColor(-1, 0xC0C0C0)
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
MfG
Olfibits