Hallo zusammen.
Ich hatte folgendes, was ich lösen mußte.
Ich habe ein Combofeld. Nur wenn dieses ausgewählt ist, dann kann man sich zwischen dem Radio1-Button und dem Radio2-Button entscheiden.
Das war schnell gemacht.
Entscheidet man sich für Radio1, dann soll als erstes geprüft werden, ab die Angabe im Inputfeld eine Zahl kleiner gleich 1899 ist. Wenn Nein, dann "Meckermeldung" und setzen des maximalen zugelassenen Wertes in das Inputfeld zurück. Wenn der eingegebene Wert kleiner gleich 1899 ist, dann die Zahl in eine Datei schreiben.
Entscheidet man sich für Radio2, soll das aus dem Kalender ausgewählte Datum in die gleiche Datei geschrieben werden, aber der Alte Inhalt muß vorher gelöscht werden.
Habe einfach die Datei neu erstellen lassen, was sicherlich nicht die brave englische Art ist, aber erstens bin ich Dänin und zweitens sind wir doch hier in Deutschland.
Nehme gerne Verbesserungsvorschläge an, denn so lernt Frau ja auch dazu.
Hier das Script:
Spoiler anzeigen
#cs
Script Nr. 17 von 81 für Projekt "Grafische Oberfläche X_26"
#ce
#include<File.au3>
#include<GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("44_45_46_47_CB_RB_RB", 362, 80, 193, 125)
$Checkbox46 = GUICtrlCreateCheckbox("Checkbox46", 5, 5, 89, 15)
$Radio1 = GUICtrlCreateRadio("Radio60", 100, 5, 60, 15)
$Radio2 = GUICtrlCreateRadio("Radio61", 100, 28, 57, 15)
$Input23 = GUICtrlCreateInput("1899", 165, 2, 33, 21)
$Date1 = GUICtrlCreateDate("2009/09/21 16:08:49", 165, 25, 186, 21)
$Button1 = GUICtrlCreateButton(" A U S G A B E ", 5, 48, 346, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$checked = 0
GUICtrlSetState($Radio1, $GUI_DISABLE)
GUICtrlSetState($Radio2, $GUI_DISABLE)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox46
IF $checked = 0 Then
GUICtrlSetState($Radio1, $GUI_ENABLE)
GUICtrlSetState($Radio2, $GUI_ENABLE)
$checked = 1
Else
GUICtrlSetState($Radio1, $GUI_DISABLE)
GUICtrlSetState($Radio2, $GUI_DISABLE)
$checked = 0
EndIf
Case $Radio1
if GUICtrlSetState($Radio1, $GUI_CHECKED) And GUICtrlRead($Input23) >=1900 Then
Msgbox(0,"MELDUNG", "Wert maximal 1899")
GUICtrlSetData($Input23,"1899")
EndIf
If GUICtrlSetState($Radio1, $GUI_CHECKED) AND GUICtrlRead($Input23) <=1899 Then
_FileCreate(@ScriptDir & "\44_45_46_47.txt")
FileOpen(@ScriptDir & "\44_45_46_47.txt",1)
FileWrite(@ScriptDir & "\44_45_46_47.txt", GUICtrlRead($Input23))
FileClose(@ScriptDir & "\44_45_46_47.txt")
Msgbox(0,"MELDUNG", GUICtrlRead($Input23)) ; nur zum testen
EndIf
Case $Radio2
If GUICtrlSetState($Radio2, $GUI_CHECKED) Then
Local $Date1, $DTM_SETFORMAT_, $style, $1_day ; ----------------> Anfang : ;Example_date1()
; Um ein bestimmtes Standardformat auszuwählen
$DTM_SETFORMAT_ = 0x1032
$style = "dd.MM.yyyy"; HH:mm:s"
GUICtrlSendMsg($Date1, $DTM_SETFORMAT_, 0, $style)
GUISetState()
$1_day = StringSplit(GUICtrlRead($Date1),".",1)
_FileCreate(@ScriptDir & "\44_45_46_47.txt")
FileOpen(@ScriptDir & "\44_45_46_47.txt",1)
FileWrite(@ScriptDir & "\44_45_46_47.txt", $1_day[3]&$1_day[2]&$1_day[1])
FileClose(@ScriptDir & "\44_45_46_47.txt")
MsgBox(0, "Zeit", $1_day[3]&$1_day[2]&$1_day[1]) ; ----------------> Ende : ;Example_date1() ; nur zum testen
EndIf
Case $Button1
EndSwitch
WEnd