Open Context Menu at Point and Click a Menu Item in There

Replying to myself.

@alexcr Started a Thread on a very similar question a few months ago.

I have to say that the main problem I have found with trying to automate context menus is that the mouse pointer has to be directly over the highlighted item before the Macro is Triggered.

This means the Macro cannot be Triggered from a Keyboard Maestro Menu as that involves moving the mouse away from the selected item.

With AppleScript it is possible to invoke the Context Menu of a highlighted item without the mouse hovering over it. But there is no generic AppleScript. It is a different Script for each Application. And it seems that apart from an AppleScript to do this in the Finder, no others are out there (from my searches in the past).

With @appleianer’s BetterTouchTool method I have found the same thing - i.e. it only works if the mouse is floating on top of the highlighted item. As soon as the mouse moves away (even though the item is still highlighted) it doesn’t work. (Unless I am doing it wrong @appleianer?)

1 Like

No @Zabobon you do nothing wrong. You can put this action first in your KM macro just to be safe.


This would ensure that the cursor will be over the correct selection.

1 Like

You are absolutely right @appleianer - that works really well!

Just for completeness for @halloleo I'll point out that the highlight colour needs to be copy and pasted from the actual App on your computer as the highlight colour might not be blue. In my case Music has red as the highlight colour.

Also to add that I like to put a sound at the end of the Macro so I can hear it has done its job.

So, adding in @appleianer's suggestion for the start of the Macro and adding the Notification Sound at the end the Music Playlist example Macro would look like this:

Context Menu in Music App - Example for Forum [version 2].kmmacros (43.2 KB)

1 Like
1 Like