GUI Problem mit der wieder gabe bitte um hilfe

12/01/2018 16:41 Goliard2k6#1
HI leute habe da ein kleines Problem mit der schleifen Funktion
es wird ausgeführt aber leider nur in dauerschleife.







HotKeySet("{F3}", "Ende")

#RequireAdmin
#include <ImageSearch.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


$Form1_1 = GUICreate("Lord", 200, 583, -1, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))

$Start = GUICtrlCreateButton("Start", 22, 504, 75, 25, $WS_GROUP)
$Beenden = GUICtrlCreateButton("Beenden", 23, 544, 75, 25, $WS_GROUP)

$Wartezeit = GUICtrlCreateCheckbox("", 24, 460, 97, 17)

$Checkbox1 = GUICtrlCreateCheckbox("Lord", 24, 20, 97, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Arial Black")

$Checkbox2 = GUICtrlCreateCheckbox("Erste Bild", 24, 50, 97, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Arial Black")

$Checkbox3 = GUICtrlCreateCheckbox("Helfen", 24, 80, 97, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Arial Black")

$Pic1 = GUICtrlCreatePic("Background.jpg", 0, 0, 550, 440, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)

$x1 = 0
$y1 = 0

Func Start()
If (GUICtrlRead($Checkbox1)) = $GUI_CHECKED Then
While 2

$result = _ImageSearch("1.Lord.bmp", 1, $x1, $y1, 90)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)
$nMsg = GUIGetMsg()
$result = _ImageSearch("1.Fragestellen.bmp", 1, $x1, $y1, 90)
If $result = 1 Then $result = _ImageSearch("1.Erste Bild 1 Kreutz.bmp", 1, $x1, $y1, 30)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)
Sleep(1000)
$nMsg = GUIGetMsg()
;~ If (GUICtrlRead($Checkbox1)) = $GUI_UNCHECKED Then $nMsg = GUIGetMsg()
WEnd

EndIf



If (GUICtrlRead($Checkbox2)) = $GUI_CHECKED Then
While (3)
$result = _ImageSearch("99.bmp", 1, $x1, $y1, 90)
If $result = 1 Then $result = _ImageSearch("00.bmp", 1, $x1, $y1, 30)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)
$nMsg = GUIGetMsg()
WEnd
EndIf

If (GUICtrlRead($Checkbox3)) = $GUI_CHECKED Then
While 2

$result = _ImageSearch("Bild 1.bmp", 1, $x1, $y1, 90)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)

$result = _ImageSearch("Bild 2.bmp", 1, $x1, $y1, 90)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)

$result = _ImageSearch("Bild 3.bmp", 1, $x1, $y1, 90)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)

$result = _ImageSearch("Bild 4.bmp", 1, $x1, $y1, 90)
If $result = 1 Then MouseClick("left", $x1, $y1, 1)
$nMsg = GUIGetMsg()
WEnd
EndIf

MsgBox(64, "Error!", "Es konnte der gewünschte Befehl nicht ausgeführt werden. Stellen sie bitte sicher, ob sie eine Checkboxen aktiviert haben")
EndFunc ;==>Start

Func Ende()
Exit
EndFunc ;==>Ende

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start
Start()
Case $Beenden
Ende()
EndSwitch
WEnd





das ganze soll so sein das wenn das erste Kontrollkästchen aktiviert ist und ich start drücke das er dann nur das erste bild als schleife solange bis der harken rausgemacht wird.

das ganze für alle Bilder

zwischendurch sinds auch 2 bilder die zusammen gehören

vielleicht kann mir dabei jeman behilflich sein
wenn das läuft läüft der rest auch
12/01/2018 17:48 Moneypulation#2
Ist doch klar, dass du in Endlosschleifen endest, wenn du ständig welche erstellst mit While 1 While 2 etc. Die Zahl steht btw auch nicht für ne Aufzählung an While-Schleifen oder so, sondern für die Bedingung. Und bei Zahlen wird alles außer 0 als true ausgewertet.

Entweder du machst eine Bedingung rein, die für dich Sinn macht, oder machst eine Bedingung in den Schleifenkörper, wo er mittels ExitLoop aus der Schleife kann. Ich hab deine Frage auch nicht ganz verstanden. Ist das so gemeint, dass solang $Checkbox1 angeklickt ist, er diese Schleife ausführen soll, und sobald man den Haken wegmacht, wieder nicht? Wenn ja, schau dir mal das an: [Only registered and activated users can see links. Click Here To Register...]