Hello,im pretty new to coding and i need your help.i tried to create a script which should do the following steps:1. search for image2. if it appears right click on it3. if it doesnt appear do some mouse clicks4. search for image again5. if it appears right click on it6 if it doesnt appear do some mouse clicksand so on and so onmy result is:without the else part the script is fine and it would right click on the image if it appears, however when i added the else part it wouldnt click on the image anymore if it appeared. (i think i use the else function wrong but let me know what you guys think)
#include <ImageSearch.au3>
HotKeySet("s", "Start")
HotKeySet("e", "_Exit")
Global $y = 0, $x = 0
Func Start()
While 1
sleep (100)
$file = @DesktopDir & '\Coronet.bmp'
local $search = _ImageSearch($file, 1, $x, $y, 0)
if $search = 1 Then
MouseClick("right", $X, $Y)
Sleep (50)
Else
MouseClick ("left", 929, 691) ;mble window schliessen
Sleep (200)
MouseClick ("left", 960, 459) ;Gheed
Sleep (200)
MouseClick ("left", 960, 359) ;auf glücksspiel drücken
Sleep (500)
EndIf
Wend
EndFunc
I appreciate your help!