Jump to content

And/Or Issue? [CLOSED]


IAMK
 Share

Recommended Posts

I observed 2 misbehaviours. Is the issue my understanding or AutoIT itself?

My script is supposed to sleep until 1 of 2 desired colours is seen.

While(PixelGetColor(260, 975) <> 39922 Or PixelGetColor(260, 975) <> 41714)
    Sleep(500)
WEnd

The above should sleep if colour1 is true and colour2 is false? Mine didn't sleep. (I guess Or moves left->right until first pass is seen)

While(PixelGetColor(260, 975) <> 39922 And PixelGetColor(260, 975) <> 41714)
    Sleep(500)
WEnd

The above should sleep if both colours are false? Mine didn't sleep if colour2 was true. (Note this is the code I currently use but don't understand why it's failing).

Edited by IAMK
Link to comment
Share on other sites

Can't tell you what the limitations of While Expressions are, but it appears that it only likes a single expression, for example:

While PixelGetColor(260, 975) <> 39922
    Sleep(500)
WEnd

However you can use multiple expressions within the loop for example:

While 1
    If PixelGetColor(260, 975) = 39922 Or PixelGetColor(260, 975) = 41714 Then ExitLoop
    Sleep(500)
WEnd

 

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