[HELP]Hilfe mit Do-Until

08/11/2009 15:38 lucabest#1
ich habe den code:

Code:
#include <GUIConstants.au3>
Global $mouse

HotKeySet("{F1}", "Enable")
mousegetpos()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Schlichter", 498, 79, 193, 125)
$Label1 = GUICtrlCreateLabel("Fahre mit der Maus auf den gewünschten Ordner und drücke dann F1!", 8, 8, 478, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Start", 8, 32, 481, 41, 0)
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetFont(-1, 14, 800, 0, "Footlight MT Light")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			suchen()
	EndSwitch
WEnd

Func Enable()
	$mouse=Mousegetpos()
	GUICtrlSetState($Button1, $GUI_ENABLE)
EndFunc


Func Suchen ()
	WinMinimizeAll()
	Do
$coord = PixelSearch( 0, 0, 1679, 1015,0x747475)
Sleep(100)
MouseMove($coord[0], $Coord[1])
MouseDown("LEFT")
Sleep(200)
MouseMove($mouse[0], $mouse[1])
Sleep(40)
MouseUp("LEFT")
Until @error=1 
MsgBox(0, "Fertig!", "Arbeiten abgeschlossen")
EndFunc
ich will das er nach dem farbwert sucht, und wenn er keinen mehr findet die msg box öffnet.
Jetzt sucht er... wenn er keinen mehr findet kommt logischerweise eine error box. Kann man den Code noch vereinfachen?(Können bestimmt, kann mir das wer machen)?

lg lucabest :D
08/11/2009 17:40 SCORNI#2
easy
PHP Code:
#include <GUIConstants.au3>
Global $mouse

HotKeySet
("{F1}""Enable")
mousegetpos()
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Schlichter"49879193125)
$Label1 GUICtrlCreateLabel("Fahre mit der Maus auf den gewünschten Ordner und drücke dann F1!"8847820)
GUICtrlSetFont(-1108000"MS Sans Serif")
$Button1 GUICtrlCreateButton("Start"832481410)
GUICtrlSetState($Button1$GUI_DISABLE)
GUICtrlSetFont(-1148000"Footlight MT Light")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            suchen
()
    EndSwitch
WEnd

Func Enable
()
    
$mouse=Mousegetpos()
    
GUICtrlSetState($Button1$GUI_ENABLE)
EndFunc


Func Suchen 
()
    
WinMinimizeAll()
    while 
1
$coord 
PixelSearch0016791015,0xAEAEAE)
if 
not @error then
Sleep
(100)
MouseMove($coord[0], $Coord[1])
MouseDown("LEFT")
Sleep(200)
MouseMove($mouse[0], $mouse[1])
Sleep(40)
MouseUp("LEFT")
EndIf
if @
error Then
MsgBox
(0"Fertig!""Arbeiten abgeschlossen")
exit
endif
wend
EndFunc 
08/11/2009 17:45 lucabest#3
JA thx funzt.
Vielen Dank Scorni


vote4Close