hab mir mal ein timer programm geschrieben das ich eine zeit lang häuft (immer zum ausmachen des pcs) benutzt habe. habs jetzt um einiges verbessert (so gut wie ich konnte!). könnt mir ja ma feedback geben wie es euch gefällt un so.
und ach ja könnt mir vill jemand sagen wie ich das so bekomme das wenn ich den info button klicke ein fenster zum browsen eines pfades kommt un der ausgewählte pfad dann in die inputbox kommt? wusst einfach nich wie man das macht
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=D:\Scripts\koda_1.7.2.0\Forms\timersleep.kxf
$Form1_1 = GUICreate("Timer", 440, 316, 194, 129)
$inputhour = GUICtrlCreateInput("", 8, 16, 73, 21)
$inputmin = GUICtrlCreateInput("", 8, 48, 73, 21)
$labelhour = GUICtrlCreateLabel("Geben Sie ein nach wie vielen Stunden der Timer beendet werden soll.", 88, 20, 339, 17)
$Label1 = GUICtrlCreateLabel("Geben Sie ein nach wie vielen Minute der Timer beendet werden soll.", 88, 52, 339, 17)
$Settings = GUICtrlCreateGroup("Settings", 8, 112, 417, 145)
$soundplay = GUICtrlCreateRadio("Play Sound", 16, 136, 73, 25)
$turnfeaturesradio = GUICtrlCreateRadio("Turn Features", 16, 176, 89, 25)
$msgfeatures = GUICtrlCreateRadio("Messagebox Features", 16, 216, 129, 25)
$soundpfad = GUICtrlCreateInput("", 96, 136, 265, 21)
$turnfeaturescombo = GUICtrlCreateCombo("Herunterfahren", 112, 176, 249, 25)
GUICtrlSetData(-1, "Standby|Ruhezustand")
$msgfeaturesinput = GUICtrlCreateInput("", 152, 216, 209, 21)
$Button1 = GUICtrlCreateButton("Info", 376, 216, 33, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Set Pfad", 368, 136, 49, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$timerstart = GUICtrlCreateButton("TIME IT", 104, 264, 241, 41, $WS_GROUP)
$Label2 = GUICtrlCreateLabel("oder geben sie eine Uhrzeit ein", 8, 80, 150, 17)
$inathour = GUICtrlCreateInput("", 160, 80, 25, 21)
$Label3 = GUICtrlCreateLabel(":", 192, 80, 7, 17)
$inatmin = GUICtrlCreateInput("", 200, 80, 25, 21)
$Label4 = GUICtrlCreateLabel("Uhr", 232, 80, 21, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $timerstart
$h = GUICtrlRead($inputhour)
$min = GUICtrlRead($inputmin)
$h = $h*60*60
$min = $min*60
$athour = GUICtrlRead($inathour)
$atmin = GUICtrlRead($inatmin)
$setread1 = GUICtrlRead($soundplay)
$setread2 = GUICtrlRead($turnfeaturesradio)
$setread3 = GUICtrlRead($msgfeatures)
$timermsgtxt= GUICtrlRead($msgfeaturesinput)
$x = guictrlread($turnfeaturescombo)
$sound_pfad = GUICtrlRead($soundpfad)
WinSetState ( "Timer", "", @SW_HIDE )
if $setread1 = 1 Then
timer_soundplay()
Exit
EndIf
if $setread2 = 1 Then
timer_sleep()
Exit
EndIf
if $setread3 = 1 Then
timermsg()
Exit
EndIf
case $Button1
MsgBox(64,"Info","Gebe hier einen Text ein der nach ablaufen der Zeit angezeigt werden soll, z.B. eine Erinnerung/Tätigkeit.")
Case $Button2
$sounddatei = FileOpenDialog("Wähle dein Sound","","Lieder (*.mp3;*.wav)")
GUICtrlSetData($soundpfad,$sounddatei)
EndSwitch
WEnd
func timermsg()
timermsgattime()
For $zeit = $h+$min to 0 Step -1
sleep(1000)
Next
MsgBox(1,"Timer",$timermsgtxt)
EndFunc
func timermsgattime()
if $h = '' Then
if $min = '' Then
while 1
if @hour = $athour Then
while 1
if @min = $atmin Then
MsgBox(1,"Timer",$timermsgtxt)
exit
EndIf
sleep(1000*3)
wend
EndIf
sleep(1000*5)
WEnd
EndIf
EndIf
EndFunc
func timer_sleep()
timer_sleep_time()
if $x = "Herunterfahren" Then
$aus = 1
elseif $x = "Standby" Then
$aus = 32
ElseIf $x ="Ruhezustand" Then
$aus = 64
EndIf
For $zeit = $h+$min to 0 Step -1
sleep(1000)
Next
Shutdown ($aus)
EndFunc
func timer_sleep_time()
if $h = '' Then
if $min = '' Then
while 1
if @hour = $athour Then
while 1
if @min = $atmin Then
if $x = "Herunterfahren" Then
$aus = 1
elseif $x = "Standby" Then
$aus = 32
ElseIf $x ="Ruhezustand" Then
$aus = 64
EndIf
Shutdown ($aus)
exit
EndIf
sleep(1000*3)
wend
EndIf
sleep(1000*5)
WEnd
EndIf
EndIf
EndFunc
func timer_soundplay()
timer_soundplay_time()
For $zeit = $h+$min to 0 Step -1
sleep(1000)
Next
SoundPlay($sound_pfad,1)
EndFunc
func timer_soundplay_time()
if $h = '' Then
if $min = '' Then
while 1
if @hour = $athour Then
while 1
if @min = $atmin Then
SoundPlay($sound_pfad,1)
exit
EndIf
sleep(1000*3)
wend
EndIf
sleep(1000*5)
WEnd
EndIf
EndIf
EndFunc