Sign in to follow this  
Followers 0
Guest nait

While-Loop for Noobs

7 posts in this topic

Hi!

If i want to let the following script run, it says

"WEnd" statement with no matching "While" statement

Heres the code:

$count = 1
While $count = 1
    If PixelGetColor( 770 , 473 ) = 7701591 Then
    MouseClick ( "left", 720, 475)
    else $count = 0
WEnd

What did i do wrong?

thx in advance

Share this post


Link to post
Share on other sites



No EndIf statement, it looks through the entire script for EndIf first, so WEnd is skipped because End-of-File is already reached


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@nait

Cough... I think you forgot something.

Fixed version your code...

$count = 1
While $count = 1
   If PixelGetColor( 770 , 473 ) = 7701591 Then
      MouseClick ( "left", 720, 475)
   Else
      $count = 0
   EndIf
WEnd

Personal way of doing it...

While 1
   If PixelGetColor( 770 , 473 ) = 7701591 Then
      MouseClick ( "left", 720, 475)
      ExitLoop
   EndIf
WEnd
Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

hehe, i didn't even catch that...sorry


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Personal way of doing it...

While 1
   If PixelGetColor( 770 , 473 ) = 7701591 Then
      MouseClick ( "left", 720, 475)
      ExitLoop
   EndIf
WEnd

<{POST_SNAPBACK}>

I think he wants to exitloop if the pixel doesn't match.

like.....

While 1
    If PixelGetColor( 770 , 473 ) <> 7701591 Then 
        ExitLoop
    EndIf
    MouseClick ( "left", 720, 475)
WEnd

.

Share this post


Link to post
Share on other sites

Thanks quick_sliver007, I replied in a rush and must of overlooked.

<{POST_SNAPBACK}>

You welcome, I do the same thing sometimes and end up tring to edit the post before someone see it. :)

.

Share this post


Link to post
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
Sign in to follow this  
Followers 0