Imagesearch doesnt find Image !

05/02/2013 22:00 DDHacker#1
Hey Guys,
I really dont know what to do anymore , the script I made doesnt find the image that It should and I dont know what i am doin wrong.
I want that it always presses F2 until the Image was found and if the Image was found it should stop and exit.
Heres my code :

Code:
#RequireAdmin
#include <ImageSearch.au3>
GUICreate("AwakeBot"  ,200,150 )
GUICtrlCreateLabel ("Versuche:",  1, 30, 50)
GUISetState (@SW_SHOW)

HotKeySet("{NUMPAD1}","_starten")
HotKeySet("{NUMPAD3}","_beenden")
HotKeySet("{p}","_pause")

$x1 = 1366
$y1 = 768
$info = GUICtrlCreateLabel ("Erwecken...",  1, 70, 1000)
$Versuche = GUICtrlCreateLabel ("0",  50, 30, 50)
Global $x1 = 0, $y1 = 0, $info, $tolerance = 0, $resultPosition, $Versuche
$findImage = _ImageSearch('Awake', 1, $x1, $y1, 100)

	While 1
	   Sleep(1)
   WEnd

_ImageSearchArea($findImage = _ImageSearch('Awake', 1, $x1, $y1,50), $resultPosition = 1, 1366, 768, 1366, 768, $x1, $y1,$tolerance = 50)

Func _starten()
   while 1
   Send("{F2 down}")
   Sleep(700)
   Send("{F2 up}")
   GUICtrlSetData ($Versuche, GUICtrlRead($Versuche) + 1)
    _ImageSearchArea($findImage, $resultPosition, 0, 0, 1366, 768,$x1 ,$y1 ,$tolerance)
   If $findImage = True Then
	GUICtrlSetData($Info, "Fertig")
	Sleep(10000)
	Exit
EndIf
WEnd
EndFunc

   Func _pause()
  GUICtrlSetData($Info, "Paused")
    Sleep(20000)
    GUICtrlSetData($Info, "Normal State")
 EndFunc

 Func _beenden()
	Exit
EndFunc
I would really appriciate if somebody would explain me the problem clearly :D
thanks you