Jump to content
Macro Express Forums

Wait for pixel color change config


Recommended Posts

I am just starting to work with MEP, and am not at all a programmer.  So I'm hoping this question will be an easy one for the users that have been around for years...
Ref: which gave me the idea:

My goal - I have a program that will be processing a variable amount of barcode documents, and am not sure how long each batch will take - usually less than 2 minutes.  So I hope to use a "wait for pixel color" to change to trigger that the batch is completed. 

Here's what I have so far, that's not working:

The color of the text changes to blue which is 9109504, based on the Mouse Locator reading.
The coordinates of the exact full screen location are x=437 and y=741

<REPEAT UNTIL Variable="%N[1]%" Condition="\x00" Value="9109504"/>
<GET PIXEL COLOR Option="\x01" Rel_To_Screen="TRUE" X="437" Y="741" Destination="%N[1]%"/>
<DELAY Flags="\x01" Time="2"/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="9109504" IgnoreCase="FALSE"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ALT>f"/>
<TEXT TYPE Action="0" Text="X"/>

The messages at the bottom of the script editor say:
Line 1: Missing "End Repeat"
Line 5: Mismatched "End Repeat"

59825a4275954_GetPixelColor.jpg.3f93b06221dc9a78ac1f33417ac24638.jpg

Thank you in advance for your able assistance!
Bruce in Fayetteville, TN.

Link to comment
Share on other sites

You are close, but the IF needs an END IF.  
Structurally the code below should work and should not produce an error diagnostic.
Logically your instructions check the pixel color variable twice: (1) in the REPEAT UNTIL line and (2) in the IF VARIABLE EQUALS line.  You don’t need to check it both places, because either one will exit from the REPEAT loop and go to the TEXT TYPE instruction.    

Repeat Until Variable Equals
   Get Pixel Color into Variable
   If Variable Equals
      Repeat Exit
   End If

   Delay 2 Seconds
Repeat End

Text Type
Text Type

 

 

 

Link to comment
Share on other sites

Cory and rberg - Got it!  Works like a champ.
The first four lines are all that's needed to make this work.  The remaining lines are used to exit out of the running program.
I really appreciate your quick assistance!  This MEP has amazing capabilities, and it's wonderful to have expert assistance in this forum to sort out the nitty gritty details for us novice users.  Thank you!

5983342db78e8_GetPixelColor2.jpg.a2ae2331b34c1d75d4b5a3f4bb87fb7e.jpg

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