Hallo zusammen,
ich habe mich mal an einer GUI probiert nur leider ohne Erfolg. Habe mir eine kleine GUI erstellt wo 2 input felder sind und ein start und exit Button.
Wenn der Start Button gedrückt wird soll er das eigentliche Script starten was auch den inhalt von der Anzahl Input Box benötigt.
Nur funktioniert es nicht ganz bzw. die 2te While Schleife funkioniert nicht ganz.
Wenn ich bei Anzahl 10 eingebe kommt die MsgBox "Die Schleife läuft noch 1 mal durch"
Wo mache ich den Fehler?
Danke und Gruß
Norman
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $input_anz, $input_pw
[/autoit][autoit][/autoit][autoit]#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 371, 146, 192, 124)
$input_anz = GUICtrlCreateInput("", 56, 40, 97, 21)
$Label1 = GUICtrlCreateLabel("Anzahl", 72, 16, 36, 17)
$Label2 = GUICtrlCreateLabel("PW", 235, 18, 22, 17)
$input_pw = GUICtrlCreateInput("", 208, 40, 89, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Button1 = GUICtrlCreateButton("START", 32, 88, 89, 33)
$Button2 = GUICtrlCreateButton("Exit", 208, 88, 89, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($input_anz) And GUICtrlRead($input_pw) Then
_start2()
Else
MsgBox(64, "Fehler" , "FEHLER")
EndIf
Case $Button2
Exit
EndSwitch
WEnd
Func _start2()
While $input_anz >= 1
$input_anz -= 1
Sleep (1000)
; -------------------------- If Abfrage um darzustellen wie oft die Schleife noch läuft ----------------
If $input_anz = 0 Then ; Wenn $input_anz gleich 0 kommt folgende MsgBox.
MsgBox (0, "Anzahl", "Anzahl = " & $input_anz , 3)
Exit
ElseIf $input_anz = 1 Then ; Wenn $input_anz gleich 1 kommt folgende MsgBox
MsgBox(64, "INFO", "Die Schleife wird noch " & $input_anz & " durchlaufen", 3)
EndIf
; --------------------------- If Abfrage Ende -------------------------------
WEnd
Sleep(1000)
Exit
EndFunc