Is it possible to ignore color of image

Sometimes you think "is automating this worth the up-front effort?"

Well - what if you could avoid making those 80+ images in the first place and have just the one that doesn't rely on colour - just like you originally asked? I've been thinking about this from a different angle and come up with this idea:

Suppose your screen isn't showing any colour in the first place, so then you'd be looking for the hamburger menu in black and white. I've tested this idea and it does work!

Here's the pseudocode:

. . .
. . .
turn on 'Use Grayscale' in System Preferences/Accessibility
perform your screen search for a monochrome hamburger
    if found, do your actions . . .
turn off 'Use Grayscale' in System Preferences/Accessibility
. . .
. . .

Things to note:

  1. Your workflow will be interrupted briefly by the screen display turning to gray scale and back again. If you can put up with this it could be a viable approach for you.
  2. I've tested this only on Mojave.

Here's the macro I used to toggle the gray scale on/off:

Toggle Greyscale State.kmmacros (8.9 KB)

Click to see macro

You'll notice that it uses AppleScript to perform the toggling and the code is from the Internet where I found it. It includes stuff for other versions of macOS but the fact that I had to modify what was there for Mojave means there's no guarantee it will work for those other versions as well without further modification.

You'll notice I'm not giving you a full-blown macro that does everything you want since you'v already got the bit that does the image search and mouse movement. You'll just have to retake that screenshot of the hamburger menu while the display is in grey scale mode. And, of course, I'm on Mojave which is getting more obsolete by the day... :wink:

Keep us all posted on how you get on anyway because your problem is a common one that I've never seen a decent solution for.

3 Likes