Jump to content
Macro Express Forums

Need help with Macro Express Pro 6 - Waiting for a specific color to appear on the screen


Recommended Posts

Hello everyone,

I'm trying to automate a task that involves waiting for a specific color to appear on a specific area of the screen for a maximum amount of time and then performing a set of actions. Is this possible with Macro Express? If so, how can I accomplish this?

I have been using Macro Express Pro 6 for a while now and I love it. However, this is the first time I have come across a task that requires me to do this. I would greatly appreciate it if someone could guide me in the right direction.

Thank you in advance for your help.

Best regards,
Vorg

Link to comment
Share on other sites

I don't know what's going on with that one. Acantor's is more what you want to look at.

As I suggested, you need to make sure it's the exact color. There are thousands of shades of green. What does your picker say the color is and does it vary any? 

Link to comment
Share on other sites

the color my macro search for is white and im sure that it's the exact color, i got the location and the color from another macro that already works for a different task, when i said "green" i was referring to what i highlighted on the image, the macro execute all that but it stops, normally as i understood the macro should return to the beginning of the macro when it sees  macro return on the script, apparently it doesn't, it just stops

Link to comment
Share on other sites

2 hours ago, vorg said:

i understood the macro should return to the beginning of the macro when it sees  macro return on the script, apparently it doesn't, it just stops

 

Macro Return means exit from the macro, NOT start over at the beginning of the script.  A bit confusing, yes....

 

I like the script you listed, because it allows for the possibility that the correct color will NEVER appear.  The Repeat loop looking for color will eventually end whether it finds the color or not.  So if it ends without finding the color, you would never know -- except that the macro AGAIN double-checks the color after exiting or finishing the Repeat, and only if it ended successfully does it go on with its normal functions. 

 

When I say the Repeat loop will "eventually" end even if the color is not found, you will have to be very patient.  One million repeats, with 1/5 second delay each time, may keep you up beyond your bedtime.  If you want it to wait 30 seconds, say, before giving up -- then change the Repeat command to 150 instead of 1,000,000.

Link to comment
Share on other sites

3 hours ago, Cory said:

What does Acantor's do with the correct value?

Sorry for the wait, a good portion of my city lost power, we have some strong winds today.
however i didn't try Acantor's script, now rberq told me that Macro return doesn't mean to start at the beginning of the script.

Link to comment
Share on other sites

1 hour ago, rberq said:

 

Macro Return means exit from the macro, NOT start over at the beginning of the script.  A bit confusing, yes....

 

I like the script you listed, because it allows for the possibility that the correct color will NEVER appear.  The Repeat loop looking for color will eventually end whether it finds the color or not.  So if it ends without finding the color, you would never know -- except that the macro AGAIN double-checks the color after exiting or finishing the Repeat, and only if it ended successfully does it go on with its normal functions. 

 

When I say the Repeat loop will "eventually" end even if the color is not found, you will have to be very patient.  One million repeats, with 1/5 second delay each time, may keep you up beyond your bedtime.  If you want it to wait 30 seconds, say, before giving up -- then change the Repeat command to 150 instead of 1,000,000.

i tried with 100 150 200, the problem was that Macro Return wasn't for what i tough, my mistake didn't knew that.
my question will be, there is a way to do that? making the macro to start over from the beginning without going over the whole script ?

Link to comment
Share on other sites

Yes, you can start at the beginning...

 

:Start
Repeat Start (Repeat 10 times)
  Mouse Move: 100, 200 Relative to Screen
  Get Pixel Color from Beneath the Mouse into %Pixel%
  If Variable %Pixel% Equals "123456"
  // Success. Do something and then stop
    Macro Stop
  Else
    Delay: 1000 milliseconds
  End If
End Repeat
// The colour was not found after ten seconds. Try again!
Goto:Start
	

 

...but this kind of script can lead to a lot of mischief. I think it's better to have a fail-safe... If the colour is not found after a certain amount of time, the macro should simply stop. Otherwise, you risk an infinite loop.

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