Jump to content

New to using imagesearch function


Soi0
 Share

Recommended Posts

Could anyone please show me where I went wrong?

It keeps saying "No matching "While" for WEnd"

#include <ImageSearch.au3>
MsgBox(0,"Notice","Click Ok to start.")
$x1=0
$y1=0
While 1
Scania = _ImageSearch ("Scania.bmp",1,$x1,$y1,100)
if Scnia = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
    WEnd
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(1000)
five= _ImageSearch ("5.bmp,",1,$x1,$y1,100)
six= _ImageSearch ("6.bmp,",1,$x1,$y1,100)
two= _ImageSearch ("2.bmp,",1,$x1,$y1,100)
fivetwo= _ImageSearch ("5two.bmp,",1,$x1,$y1,100)
nine= _ImageSearch ("9.bmp,",1,$x1,$y1,100)
ninetwo= _ImageSearch ("9two.bmp,",1,$x1,$y1,100)
if five = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
if six = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
if two = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
if fivetwo = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
if nine = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
if ninetwo = 1 Then
  MouseMove($x1,$y1,3)
  MouseClick("left",$x1,$y1,1,3)
end if
Sleep(300)
Send("{ENTER}")
Sleep(10000)
Send("{SPACE}")
Sleep(400)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{ENTER}")
Sleep(3000)
Send("{Left Down}")
Sleep(3500)
Send("{Left up}")
Send("{UP}")
EndIf
WEnd

I know it's kinda messy but I'm learning :]

Edited by Soi0
Link to comment
Share on other sites

  • Moderators

Hi, Soi0, welcome to the forum. I think you need to go back through your code with a fine tooth comb as I found a number of errors right off the bat. The WEnd in question is there very last line of your script; you have no While loop. However, I see a number of other issues, such as variables declared incorrectly.

If you're using the full version of SCiTe, hit CTRL+F5 to check the Syntax of your script (Tools menu>>SyntaxCheck Prod). This will highlight all of the errors. Good luck, and let us know if you run into any further issues ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...