Jump to content
Macro Express Forums

Little help with get pixel color?


Garp

Recommended Posts

I have been using macro Express for many years, and am always amazed to see what nifty things I can create with it. I have shown several companies how macro express can save them a lot of money. If you have ever received what looks like a canned email response from an eBay employee, you can thank me for that.

 

Anyway, working on a personal project for my parents, I have been trying to get a macro made that will grab the color of a particular pixel, then play a .wav if that pixel is that color. I'm working on a project with some wireless home automation devices that can send emails. Essentially what I want to do it this:

 

Check email and get the pixel color from a particular pixel. (one that changes from white to whatever color when an email has been received), let's say it's blue.

 

If the particular pixel color is blue when the script is run, play a .wav file.

 

Sounds simple but Im apparently not using the get pixel command correctly.

 

I have all of the "dial in, sign in, check email reader, play .wav" part set up fine.

 

I have the get pixel command setup to get the pixel from a set location, and call it %n1%. The question is: what is exactly saved as a variable and how do I then examine and if/then from that variable value?

 

Any help would be appreciated.

Link to comment
Share on other sites

I'm still fairly new at this but do you know what the pixel color is going to be? example black is 0

 

get pixel color in N1

If N1 = 0

play .wav file

end if

 

this also would allow you to do multiple wav files for different colors, if im wrong sorry but i wanted to take a stab before the guru's answered

Edit: didn't mean to qoute

Link to comment
Share on other sites

I'm still fairly new at this but do you know what the pixel color is going to be? example black is 0

 

get pixel color in N1

If N1 = 0

play .wav file

end if

 

this also would allow you to do multiple wav files for different colors, if im wrong sorry but i wanted to take a stab before the guru's answered

Edit: didn't mean to qoute

 

I assumed it would be one color when it got mail, but it's not. So the normal color is a gray color ( I thought it was white but it's not ), then can be 3-4 other colors when they get mail. so anything not that original gray, would trigger the .wav.

 

(( figured out 0 value problem )

 

The default color value is 15790320. Anything different, should trigger the wave. So in the 'If Variable" settings dialogue, which do I select to mean "if variable N1 does not equal that number", continue with the rest of the macro?

Link to comment
Share on other sites

This code snippet will find the current color at a spot on the window,

x-coordinate 120, y-coordinate 84, then it will

idle in a REPEAT loop until that color changes to something else.

I put a quarter-second delay inside the loop just on principle -- in some

computer languages it would keep the loop from eating up all available

processor time. With ME it probably doesn't make much difference.

 

If you know the default color for sure, then you can just load it into

N93 and N94 before starting the loop, rather than getting it from the

screen. Bear in mind that the default may change with 16-bit vs.

32-bit color, or if the email site changes its display a little.

 

// .... find current pixel color where the change will occur

Variable Set Integer %N91% to 120

Variable Set Integer %N92% to 84

Get Pixel: Window Coords: %N91%,%N92% into %N93%

Get Pixel: Window Coords: %N91%,%N92% into %N94%

// .... wait for selected pixel to change as a result of email

Repeat Until %N93% <> %N94%

Get Pixel: Window Coords: %N91%,%N92% into %N94%

Delay 250 Milliseconds

Repeat End

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