Jump to content

Please help for imagesearch about .. else code problem


Recommended Posts

;click this image if it isn't find above images... I have problem here :/ How can i do it ? I have else statement error...

I have problem on "else" code...

#include <ImageSearch.au3>

HotKeySet("{ESC}", "Terminate")
$x = 1000
$y = 100

While 1
          ;right 1
         $res1 = _imagesearchArea('pictures1right.png', 1, 469, 633, 626, 739, $x, $y, 0)
      If $res1 = 1 Then
         MouseMove(620,489,3)
         MouseClick ("left")
      EndIf
      
    ;left 1  
         $res1 = _imagesearchArea('pictures1left.png',1, 1300, 631, 1480, 729, $x, $y, 0)
      If $res1 = 1 Then
         MouseMove(1288, 499,3)
         MouseClick ("left")
      EndIf
      
      ;right 2
         $res1 = _imagesearchArea('pictures2right.png', 1, 469, 633, 626, 739, $x, $y, 0)
      If $res1 = 1 Then
         MouseMove(620,489,3)
         MouseClick ("left")
      EndIf
      
    ;left 2  
         $res1 = _imagesearchArea('pictures2left.png',1, 1300, 631, 1480, 729, $x, $y, 0)
      If $res1 = 1 Then
         MouseMove(1288, 499,3)
         MouseClick ("left")
      EndIf  
      
      ELSE
;click this image if it isn't find above images... I have problem here :/ How can i do it ? I have else statement error...
      
      $res1 = _imagesearchArea('change.png',1, 805, 679, 1166, 805, $x, $y, 0)
      If $res1 = 1 Then
         MouseMove($x, $y,3)
         MouseClick ("left")
      
      
      WEnd
      Func Terminate()
         Exit 0
         EndFunc
Link to comment
Share on other sites

Have a look at the "If" help.

you cannot put an else all by itself.

The pattern is

If <expression> Then
    statements
    ...
[ElseIf expression-n Then
    [elseif statements ... ]]
    ...
[Else
    [else statements]
    ...
EndIf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...