How click gear of an action?

I am tired of creating the comments I use for attributionI have a macro active in KM tKm that adds a comment with title “Attribution” and my information in the body. I would like it to color the macro yellow.

I have a laborious series of mouse movements and keystrokes that adds the color if . However, I can’t figure out how to click the action’s gear. Found Image doesn’t work because there will (almost) always be other gear’s showing. And the mouse could be anywhere, since I invoke this with a keystroke. Any ideas? (Or advice to get back to productive work?)

Can you give us a screenshot of the gear you’re trying to click on? Might be easier for us to see what you need to select. Multiple gears included of course.

The comment, title, and text are inserted by my macro. I made the macro yellow manually. I have mouse and keystroke actions to make the macro yellow if only I could open the gear menu for that specific macro. I know where the cursor is, but I can't move the mouse relative to it, and I don't see anyway to get to the cursor by way of a Found Image (or anything else).

You wont be able to click on the gear because there are so many of them.

Assuming the mouse was hovered over the action (in a neutral location like the title), and either it was not selected or it was the only thing selected, then this sequence would work:

  • Control Click at 0,0 relative to the current mouse location
  • Pause
  • Insert Text by Typing “Set Col”
  • Type a Keystroke: Right Arrow
  • Insert Text by Typing “Red”
  • Type a Keystroke: Return
1 Like

Right. I had something like that, but I couldn’t get the gear open. Oh well, back to constructive work.

Many thanks, Peter. Great little macro sequence.

I just posted a minor variation which allows the user to select the color:

My solution takes your context into account and assumes that you have just typed the attribution comment in the comment text box. After that, just trigger the macro and it'll color it yellow and collapse the comment.

Note that you may have to play around with the images and the offsets on your particular setup.

Comment Yellow (from text box).kmmacros (18.6 KB)

This doesn’t solve the main problem about which I posted. I know many ways of making the macro yellow, as long as I can get the gear menu down. This doesn’t do that.

This doesn’t work for me because the mouse could be anywhere. I am inserting the comment via a macro, invoked via a keystroke. And selecting the macro is cheating. I don’t see any way to select the macro programmatically. I want this fully automated.

An odd thought I had a while ago – is there a way to put an action in a clipboard that is never changed so that you could have another macro that pastes the action from that clipboard?

Are your comments always titled ‘Attribution’? Is that not one way of identifying and selecting the comment?

Do you want comments expanded or collapsed when done with them? If you collapse all of them them after coloring them then you have an easy way to identify comments needing to be yellow as ones that are expanded. Then collapse after turning yellow.

for each comment titled Attribution that is also expanded > select it’s gear and color it yellow

Maybe I don’t understand your full process. I can imagine how you are using macros to write a comment but maybe a video is better?

Untitled Macro File.kmmacros (5.8 KB)

And indeed there is. A starting point:

Save and Paste KM Actions Macros

These are not the exact names, but this what they do:

  1. Copy Selected KM Actions to Clipboard Saved Actions
  2. Pasted Saved Actions

Do (1), then don't touch the Saved Actions clipboard (unless you really mean to replace the saved actions). Then, wherever you want the saved actions, just do (2).

None of that matters. The challenge is to click the gear menu of a comment action whose body contains the cursor, where the mouse could be anywhere and multiple gears are in sight.

I am convinced this can’t be done. Unless an action were added to Click Mouse Relative to the Cursor, which doesn’t sound plausible though might be quite useful.

If that is your primary (only) use case for setting the color of a Comment Action, then you might be better of using Named Clipboards, like in the following macro:

It sounds doable to me - it just depends on the specifics which is why I'm trying to get as much information from you as possible. Without a video of you doing it manually I don't really know what's going on. Very easy to make a video with Quicktime.

I assume #3 is to place a comment at the top of the pasted actions? Need to know where that comes in.

Does 'Comment2' in the following image fit your use case?

Also, a right-click on anything but the gear will open the same menu as the gear so that means the gear doesn't need to be explicitly selected.

This is a standard issue on the Mac - there is no way in general to get from the insertion/selection cursor to the location on the screen. You cannot do it in Keyboard Maestro, and you cannot do it in pretty much any other application.

Keyboard Maestro does not have nearly strong enough appleScript support to allow this sort of manipulation (nor do most other applications I might add).

Comment 2. Inserted by typing a keystroke. The click has to be in the gray area of the macro, not in the title or comment. But my mouse could be anywhere, so the problem is to bring the mouse into the inserted macro or move it relative to the cursor. I’m going with saving actions to a named clipboard and leaving them there.

No surprise there.

Thank you all for your ideas. Somehow they all percolated in my brain and I realized that the answer was right in front of me. Just have to find the right image to look for — I was hung up on the gear.

Insert a Yellow Comment.kmmacros (49 KB)

I used Peter's series of actions once the gear was clicked. I had had something similar, but it used all keystrokes rather than typing. Just as using menubar actions is preferable to keystroke shortcuts (because people may rebind the menu items, with KM, the System Keyboard Preferences, or some other mechanism), typing (part of) the text of a popup menu entry is better than a series arrows to work through the menus and submenus, because the position of the item might change in subsequent releases.

It's easy enough to adjust the color using this mechanism.

Keyboard Maestro “Paste Dated Attribution Action v1.0” Macro

-Chris

Ignore the Save and Paste KM Actions Macros macro I posted above (if you haven’t already). I never moved it forward. It’s useless the way I left it.