Jump to content
Macro Express Forums

RGB Color Evaluator & how to use results


Recommended Posts

Hi,

Its me again...

my main target was to find in ME pro something that will get close to a "search Image". Since I could not find something that I could understand or close to what I was looking for, I choose to change strategy and found this link:

RGB Color Evaluator by Nathan Kelson

http://www.macros.co...orevaluator.htm

It works great, but i cannot understand how I could make use of the results. For example if the result was:

"white">Macro Run X

"black">macro Run Y

ect

Thank for the help.

 

This is the full code:

<VARIABLE SAVE Option="\x02"/>
<VARIABLE SAVE Option="\x04"/>
<COMMENT Value="Start of calculation to determine the RGB value of the pixel under the mouse"/>
<GET PIXEL COLOR Option="\x00" Rel_To_Screen="FALSE" Destination="%N[80]%"/>
<VARIABLE MODIFY DECIMAL Option="\x03" Destination="%D[80]%" Value1="%N[80]%" Value2="65536"/>
<VARIABLE MODIFY DECIMAL Option="\x07" Destination="%D[80]%" Variable="%D[81]%"/>
<VARIABLE MODIFY DECIMAL Option="\x06" Destination="%D[80]%" Variable="%N[83]%"/>
<VARIABLE MODIFY DECIMAL Option="\x02" Destination="%D[82]%" Value1="%D[81]%" Value2="65536"/>
<VARIABLE MODIFY DECIMAL Option="\x03" Destination="%D[83]%" Value1="%D[82]%" Value2="256"/>
<VARIABLE MODIFY DECIMAL Option="\x07" Destination="%D[83]%" Variable="%D[84]%"/>
<VARIABLE MODIFY DECIMAL Option="\x06" Destination="%D[83]%" Variable="%N[82]%"/>
<VARIABLE MODIFY DECIMAL Option="\x02" Destination="%D[85]%" Value1="%D[84]%" Value2="256"/>
<VARIABLE MODIFY DECIMAL Option="\x06" Destination="%D[85]%" Variable="%N[81]%"/>
<COMMENT Value="End of calculation to determine the RGB value of the pixel under the mouse"/>
<COMMENT Value="Disable the next command if you dont want to see the \"Pixel Color value\""/>
<VARIABLE SET INTEGER Option="\x01" Destination="%N[80]%" Prompt="\"Pixel Color\" value" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<COMMENT Value="Disable the next command if you dont want to see the \"Red\" RGB value"/>
<VARIABLE SET INTEGER Option="\x01" Destination="%N[81]%" Prompt="RGB Red Value" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<COMMENT Value="Disable the next command if you dont want to see the \"Green\" RGB value"/>
<VARIABLE SET INTEGER Option="\x01" Destination="%N[82]%" Prompt="RGB Green Value" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<COMMENT Value="Disable the next command if you dont want to see the \"Blue\" RGB value"/>
<VARIABLE SET INTEGER Option="\x01" Destination="%N[83]%" Prompt="RGB Blue Value" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<COMMENT Value="This section will evaluate the RGB value and return a color value"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[16]%" Value="18821096"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="20"/>
<COMMENT Value="Enable this command if you have the additional color name data macro"/>
<VARIABLE SET INTEGER Option="\x01" Destination="%N[2]%" Prompt="For basic colors: enter 20\r\nFor all colors: enter 200" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0" _ENABLED="FALSE"/>
<IF VARIABLE Variable="%N[2]%" Condition="\x03" Value="200" IgnoreCase="FALSE"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="200"/>
<END IF/>
<REPEAT WITH VARIABLE Variable="%N[2]%" UseCounter="TRUE" Counter_Variable="%N[1]%"/>
<COMMENT Value="RGB data and names for the 19 most common colors"/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="1" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Black"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="2" IgnoreCase="FALSE"/>
<BEEP/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="White"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="255"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="3" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Blue"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="255"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="4" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Red"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="5" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Green"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="6" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Yellow"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="7" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Dark Blue"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="128"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="8" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Dark Red"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="9" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Dark Green"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="10" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Dark Yellow"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="11" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Light Blue"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="255"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="12" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Light Red"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="128"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="13" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Light Green"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="128"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="14" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Light Yellow"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="128"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="15" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Orange"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="165"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="0"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="16" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Purple"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="160"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="32"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="240"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="17" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Magenta"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="255"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="18" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Dark Magenta"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="128"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="19" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Light Magenta"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="255"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="128"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="255"/>
<END IF/>
<IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="20" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="Brown"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[2]%" Value="165"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[3]%" Value="42"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[4]%" Value="42"/>
<END IF/>
<COMMENT Value="These commands search through additional colors"/>
<IF VARIABLE Variable="%N[1]%" Condition="\x03" Value="37" IgnoreCase="FALSE"/>
<MACRO RUN Use_ID="FALSE" Name="More colors" ID="-1" Wait="TRUE"/>
<END IF/>
<COMMENT Value="Calculation to determine the closest color"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[10]%" Value1="%N[81]%" Value2="%N[2]%"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[11]%" Value1="%N[82]%" Value2="%N[3]%"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[12]%" Value1="%N[83]%" Value2="%N[4]%"/>
<IF VARIABLE Variable="%N[10]%" Condition="\x02" Value="0" IgnoreCase="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[10]%" Value1="%N[2]%" Value2="%N[81]%"/>
<END IF/>
<IF VARIABLE Variable="%N[11]%" Condition="\x02" Value="0" IgnoreCase="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[11]%" Value1="%N[3]%" Value2="%N[82]%"/>
<END IF/>
<IF VARIABLE Variable="%N[12]%" Condition="\x02" Value="0" IgnoreCase="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[12]%" Value1="%N[4]%" Value2="%N[83]%"/>
<END IF/>
<VARIABLE MODIFY INTEGER Option="\x02" Destination="%N[10]%" Value1="%N[10]%" Value2="%N[10]%"/>
<VARIABLE MODIFY INTEGER Option="\x02" Destination="%N[11]%" Value1="%N[11]%" Value2="%N[11]%"/>
<VARIABLE MODIFY INTEGER Option="\x02" Destination="%N[12]%" Value1="%N[12]%" Value2="%N[12]%"/>
<VARIABLE MODIFY INTEGER Option="\x00" Destination="%N[15]%" Value1="%N[10]%" Value2="%N[11]%"/>
<VARIABLE MODIFY INTEGER Option="\x00" Destination="%N[15]%" Value1="%N[12]%" Value2="%N[15]%"/>
<IF VARIABLE Variable="%N[15]%" Condition="\x02" Value="%N[16]%" IgnoreCase="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x06" Destination="%N[16]%" Variable="%N[15]%"/>
<VARIABLE MODIFY STRING Option="\x08" Destination="%T[2]%" Variable="%T[1]%"/>
<END IF/>
<END REPEAT/>
<COMMENT Value="The next two lines can be used to remove the light or dark information from the color description"/>
<VARIABLE MODIFY STRING Option="\x0F" Destination="%T[2]%" ToReplace="Dark " All="FALSE" IgnoreCase="FALSE" _ENABLED="FALSE"/>
<VARIABLE MODIFY STRING Option="\x0F" Destination="%T[2]%" ToReplace="Light " All="FALSE" IgnoreCase="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x01" Destination="%T[2]%" Prompt="Evaluation of the RGB value to determine the color name." Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<VARIABLE RESTORE Option="\x04"/>
<VARIABLE RESTORE Option="\x02"/>

Link to comment
Share on other sites

Ummmm... How's that? Just use it. Looks like you want to run one of many possible macros so just do that with an IF condition. Maybe I'm not understanding your problem.

Link to comment
Share on other sites

Sorry maybe I didnt explain myself enough...

The above macro will give u 5 result

Pixel color - RGB Red - RGB Green - RGB Blue - Evaluation of Color

atm Im interested only in Color Evaluation, so I will disable the rest 4 and leave:

<VARIABLE SET STRING Option="\x01" Destination="%T[2]%" Prompt="Evaluation of the RGB value to determine the color name." Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>

Now, beside telling me which color it is, as u suggested,I tried to use a IF condition, but I cant understand from which variable should i get the info from.

I try something like:

<IF VARIABLE Variable="%T[2]%" Condition="\x00" Value="White" IgnoreCase="FALSE"/>
<MACRO RUN Use_ID="FALSE" Name="Pass" ID="-1" Wait="TRUE"/>

but the macro "pass" will be run with or without "white" has result!

Link to comment
Share on other sites

I'm sorry, I'm just not following and I dont' have the time to read and comprehend all of the sample macro. But doesn't it at some point set a value like "Blue" to some variable like %Color%? Then it's a simple matter of "If %Color% = Blue Then". Maybe you could give me a simple distilled example to look at. I'll follow this thread form now on and get back to you more quickly next time.

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

×
×
  • Create New...