Is it possible when KM searches for a image to ignore the color and only look for the shape in the image? For example I have an image of an event region in Studio One that has 4 small hamburger lines in the lower left corner of the region and when I trigger the KM key command the mouse jumps to the image of the 4 lines perfectly. The only snag is when I took the screenshot, the region was a red color so every time I have a region I want KM to move the mouse to and the region color is other than red I have to turn it to red all the time.
I was thinking to a screenshot of all possible colors for the macro but the other commands within the macro after clicking on the image would take way to long to set up. If KM could just look for the shape of an image would be great.
Welcome to the forum.
Unfortunately you're out of luck on this one.
Actually, I "find" like images with different colors by adding multiple screen images to the "Fine Image" action and set it to "if any are present". Then I set a variable based on "FoundImage" Token and use the variable to drive any click or other action. You'd just need to add an image for all the different color combinations. Here's an example:
I may just put in the hours and have every possible color as rcraighead suggested but that's 80+ images.
thanks for the suggestion! I'm not sure how to set this up. For the " %FoundImage% " did you type that in bc I couldn't find it in the Insert Token drop down menus so I did type it in for mine. Is the second command "Set Variable" instructing KM to go to the image and click? If it is than somehow it's not moving there, the mouse doesn't move at all. Do I need another command to move the mouse to the image and click? Here's a screenshot of my macro, the disabled commands is what I had originally and worked. Now I need to set it up where it will do the same thing but for multiple colors with the same image. (side note, a lot of times there's multiple regions with the same color so in order for KM to know which one to look at , I manually select the region and selected regions always have a blue line underneath the hamburger line and also the shade of the selected region is a bit different and that's the image i screeenshot)
What I'm trying to accomplish is the image(hamburger line) when clicked opens a drop down list to select various Takes, so KM clicks the image to open the drop down list, then down arrow once to select Take 1, then Return to close.
%FoundImage% is the result of choosing "Last Image Found" from the "All" menu item:
Tokens are often listed with different definitions than their final "Token". I think it's because the actual token is shortened and doesn't always fully describe its purpose.
Here is a more complete example:
By saving "FoundImage" coordinates as a variable it can be used to control the cursor using "relative to the: absolute position". Just start typing in the "at" field to use the variable instead of a simple number.
Read more about it in the Wiki:
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:
- 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.
- 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)
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...
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.
And following on from @tiffle, another idea...
Is there a menu item to turn the region to red?
I was just wondering if at the start of your macro, you automated turning the region red (using KM to choose the menu item)
Use your KM image search (the one where the hamburger is on red) to just move the mouse to that image (i.e. not click at this stage)
Use KM to press ⌘Z or choose Undo from the Menu (which should undo the region change to red) but will leave the mouse pointer over the hamburger.
Now use KM to click the mouse, without moving it (as it will be in the right place).
I don't have the app Studio One so, this is all just guessing...
Looks like some other good ideas for you to consider. I typically deal we no more than 3-4. It is possible not all the colors need to be included. Changing "fussiness" and "contains" vs. "contains uniquely" may provide a match with fewer samples.
That could be a lot less hassle than my idea @Zabobon! Good thinking…
Thanks rcraighead! This is working great!
Hi Zabobon, kinda, it is possible by Right clicking on the region, a color palette opens and you can navigate to a color with the RT/LT arrow keys. But how would I automate the mouse to move to the selected region in order to right click for the color palette? Wouldn’t you still need a unique image?
Didn’t know about this mode, could be very useful! But in this situation(studio one) so far there’s some snags. When putting the screen in Grayscale (black and white) Monterey 12.3, the selected region(the one I want the mouse to move to) isn’t unique enough from the other non-selected regions, unlike color regions when selected turns a different shade and has a blue outline around the region.
Notice I actually have multiple regions all having the hamburger. I think in your example, the hamburger is only on one region therefore making it unique from the rest, I could see that working.
One thing I noticed which could be a factor, even if the screen is only black and white, some regions are darker than others, most likely a blue region vs yellow. Having fun exploring this Grayscale.
Interestingly if there is a solution, it probably wouldn’t be to ignore colors like I thought at first(depending on your app I guess). You can kinda see the snags from my situation with Studio One in Grayscale. Actually, rcraighead’s solution work great and so far very reliable!
Which of @rcraighead’s approaches are you referring to?
That wasn’t clear to me from your previous posts so yes, that would result in the search returning a collection of found images (if that’s what you ask it to do) and so identifying the relevant one(s) would be challenging.
By “decent” I meant a solution that didn’t involve having to test for 80+ variations of a UI widget one by one!
Yeah 80+ is crazy. I should narrow it down to maybe 10 primary colors. That might save cpu too.
I like your Grayscale idea..if only you could set it to strictly black and white(no various shades) except for only the object you select has a different shade or something to differentiate it.
Yeah - that’s the one I use: it’s fine for a limited number of images but then gets unwieldy…
I’ve been away from my Mac but back again tomorrow and I have Studio One so tell me, which panels have the hamburger menus that you’re interested in and I’ll have a quick look…
Great! The macros select Take 1, Take 2
Take 1.kmmacros (25.6 KB)
Take 2.kmmacros (26.2 KB)
Some not-so-good news: I can't replicate your track layout that shows hamburger menus at all. Maybe it's because I have an older version of S1 or because I haven't used S1 for a long while.
In any case, the screenshot you posted shouted this to me: why are you using the hamburger menu to differentiate between all those regions when each region seems to have a unique name/ID associated with it? For example, your take 1 region has this ID tab:
It would be far better to use this in your image search and then, when found, you can click the mouse at a fixed distance below that tab to activate the hamburger menu, assuming all your tracks are the same height.
Potential problems/solutions with this approach:
Your regions might not have unique names/IDs - make sure they do
Your tracks are not all the same height - make sure they are
Colouring might prevent it working - using the grey scale approach might be more effective given you're now searching for unique names/IDs
KM search gets confused by the presence of similar image in other parts of the screen - restrict the KM to a smaller search area encompassing just the part of the screen containing the tracks
You might have a totally different understanding of what you're trying to achieve to me which makes what I've suggested useless - no solution
I've no idea how useful this will be to you bearing in mind the last point in the list above. However, I've pretty much run out of ideas so now it's back to you
Good point, forgot about that.
you may want to rename the region later and that would replace the number/id.
I ran into that, i change height and zoom often. Fortunately the burger menu doesn’t change size no matter track height or zoom.
I'm just getting into this KM, thanks for all the cool ideas!
Hope it all gets you somewhere. Cheers!