Jump to content
Macro Express Forums

"or" clause in color search


Recommended Posts

I don't think so. But that may be a blessing in disguise. I avoid "REPEAT UNTIL" because I've had too many experiences of freezes when the condition, for whatever reason, cannot be met.

But you can test for two or more conditions using IF statements. My approach is to use a "failsafe" to exit the loop if the condition is not met within a reasonable number of iterations. For example, if I am checking pixel colours along a horizontal line, the failsafe value might be the width of the screen as measured in pixels.

In pseudocode:

// Check each pixel along (x, 100) for Colour = 11111 or Colour = 22222

Failsafe = 1200
x = 0
y = 100

Repeat Failsafe Times
     Colour = Pixel Color at (x, y)
     If Colour = 11111
     OR
     If Colour = 22222
         // Pixel has been found!
         ...
         Macro Stop
      Else
          x = x + 1
Repeat End
// Pixel not found!

Link to comment
Share on other sites

That's what I would do. Use a condition to escape when the conditions are met and set it to a reasonable number of iterations just in case the value is never found. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...