Hallo liebe Gemeinde
ich schreibe gerade an einem kleinen script und versuche gerade zum ersten mal die "IF / ElseIf" Befehle zu verwenden aber mir scheint ich habe irgendwo einen kleinen denkfehler und zwar habe ich ein fenster in welchem ich eine Uhrzeit eintrage, Diese Uhrzeit wird anschließend einfach nur in eine Txt datei geschrieben jedoch möchte ich bevor das geschieht die Eingabe des ersten Inputs nocheinmal Überprüfen und sollte jemand nur z.B. eine "5" eingetragen haben das dann durch "05" zu ersetzen jedoch wird die "0" im moment auch bei zweistelligen Zahlen angefügt was ja nicht passieren sollte.
Ich hoffe ihr könnt mir helfen vielen dank im voraus
Gesamter Script :
Spoiler anzeigen
#NoTrayIcon
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <Constants.au3>
#include <ModernMenu.au3>
#include <GUIConstantsEx.au3>
$Posi1 = FileReadLine("C:\Excite\Clock\Position.txt",1)
$Posi2 = FileReadLine("C:\Excite\Clock\Position.txt",2)
$Posit1 = $Posi1 + 25
$Posit2 = $Posi2 - 99
$StandImp1 = @HOUR
$StandImp2 = @MIN
$StandImp3 = @SEC
$Style2 = FileReadLine("C:\Excite\Clock\Style.txt",1)
$Style = "C:\Excite\Clock\"& $Style2 & "\BG1A.jpg"
$Form1 = GUICreate("ExciteAlert", 250, 100, $Posit1, $Posit2,$WS_POPUP)
$Input1 = GUICtrlCreateInput($StandImp1, 90, 15, 20, 20)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput($StandImp2, 115, 15, 20, 20)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput($StandImp3, 140, 15, 20, 20)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Activate", 150, 65, 70, 25, 0)
$Button2 = GUICtrlCreateButton("Cancel", 30, 65, 70, 25, 0)
$Pic1 = GUICtrlCreatePic($Style, 0, 0, 250, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
_Exit ()
Case $Button1
_Alert ()
EndSwitch
WEnd
Func _Exit ()
Exit
EndFunc
Func _Alert ()
If GUICtrlRead($Input1) = 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 Then
$inpt1 = 0 & GUICtrlRead($Input1)
ElseIf GUICtrlRead($Input1) = 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 00 Then
$inpt1 = GUICtrlRead($Input1)
EndIf
$AlertTime = $inpt1 & ":" & GUICtrlRead($Input2) & ":" & GUICtrlRead($Input3)
FileDelete("C:\Excite\Clock\AlertTime.txt")
Sleep(500)
FileWrite("C:\Excite\Clock\AlertTime.txt", $AlertTime)
Exit
EndFunc
Relevante Stelle im Script :
Spoiler anzeigen
Func _Alert ()
If GUICtrlRead($Input1) = 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 Then
$inpt1 = 0 & GUICtrlRead($Input1)
ElseIf GUICtrlRead($Input1) = 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 00 Then
$inpt1 = GUICtrlRead($Input1)
EndIf
$AlertTime = $inpt1 & ":" & GUICtrlRead($Input2) & ":" & GUICtrlRead($Input3)
FileDelete("C:\Excite\Clock\AlertTime.txt")
Sleep(500)
FileWrite("C:\Excite\Clock\AlertTime.txt", $AlertTime)
Exit
EndFunc
MFG Eistee