Specify pixel color by variable


#1

I’m trying to specify the particular color that a pixel should be for a condition. I’m using an If / then / else, where the condition is: The pixel at: [x_coord] [y_coord] is [color]. The issue here is that while I can pick the color using the color picker and see the hex value / RGB numbers, I can’t seem to specify either the RGB or Hex number for the color using a typed value or variable. I’d like to be able to refer to the color as a variable. Is this possible?

Two examples of pixel color qualification


#2

I’m afraid there is no support for that.

Your could possibly get the pixel color using JXA. Alternatively, you could get the XML of the action, and then modify it appropriately and use tell app "Keyboard Maestro Engine" to do script to run the script to test the condition.


#3

Thanks Peter! I’m afraid that is beyond my level of understanding, but I think there’s some other ways I can go about this (create separate IF’s that will specify the colors). I appreciate the quick reply!


#4

Yes, if you have a fixed set of colors, use a Switch statement to see which one to test. That should be a good solution if you only have a few colors (where “few” is dependent on your patience level).


#5

Great suggestion, thanks Peter!


#6

I would like to add that you can check on which url Safari is at.
And you can check the text of fields.

This is all done with the Safari actions.


#7

Thanks Jimmy. The challenge here is that it’s a Citrix app portal so everything is in Java script (which I don’t know) so I have to look at a particular part of the page to see if specific things are on it like images, colors, etc. Text in HTML is not selectable, nor are the app icons setup with their own dedicated URLs. The portal URL is definitely known since I directed Safari to go to it. However, as I navigate through the pages of apps to click on, the URL remains static (ending with /# ). So, I just look to find specific colors in particular spots and this confirms whether I’m on that page as I expect or not. Then I make the mouse click on the spot I expect. It’s not perfect but I’m hoping it does the trick!


#8

I see.

Just if you had not seen the actions for Safari there a worth mentioning.


#9

But the Switch/Case action doesn't seem to support the pixel condition?


#10

Hey @JingleDjango,

No, it doesn't. See the wiki for details:

Switch/Case Action

-Chris