Has Anyone Figured Out a Way to Replicate the Windows "Menu Key" on a Mac Using KM?

Thanks @eurobubba for solving this and thanks @Zabobon for confirming! I'm relatively new to KM and haven't yet set up an AppleScript as an action. Any quick guidance on how to do this? I'm excited to try it out. This is something I've been looking for almost for a decade!

BTW, @Zabobon, you bring up a good point that beyond the basic functionality, you can also create additional macros building on this, e.g. selecting specific menu items by typing the first few letters of a context menu item and pressing enter.

The example macro I uploaded already has the AppleScript as an Action. To make new Actions with AppleScript in them in future you can select the Execute/Execute an AppleScript Action. Then you simply paste the AppleScript text into the Action.

1 Like

Got it. So I'd simply copy and paste the AppleScript text from your example macro into the AppleScript action in the new macro I'm creating?

Or you could select the whole Action itself and copy and paste that into a new Macro (Actions can be copied and pasted into other Macros).

1 Like

@Zabobon @eurobubba One other question for you guys. My keyboard actually has a "menu" key, which you can see here...https://d.pr/i/p9472V. This would be perfect to use as the trigger for this action.

However, I can't seem to get KM to recognize this key. Do you guys have any suggestions? Here's some further background that might be relevant...

http://jornane.me/doc/code-dip-v2b/

Without access to the actual keyboard it is very hard to advise you what to do. But I would guess the trigger type you could try is the "USB Device Key Trigger".

It's also worth pointing out (as @eurobubba already has) that this AppleScript only works in the Finder. It doesn't do anything in any other App. So, assigning the physical key to it is not going to completely reproduce the normal function of that key.

image

That's odd, @Zabobon. My options are laid out a bit different, and I'm not seeing a "USB Device Key Trigger" option...

What version of Keyboard Maestro are you using? Current version is 9.0.5

Same! Here's a screenshot...

image

Ah. In that case I have no idea why the list of triggers should be different. Hopefully someone else on the Forum can explain :slight_smile:︎ - only difference I can see is that yours is a trial version. I'm not sure what if any limitations the trial version has as it is so long ago I bought it.

I just made the purchase and am no longer a "trial" user. It's odd...the menu appears like yours does in some situations, but like mine does in other situations. Hm.

In either case, I'm unfortunately still not having any luck getting KM to recognize this key.

I'm sorry I wasn't able to help with that. Like I said, very hard without having access to the actual keyboard you have.

I'm sure you won't regret investing in Keyboard Maestro. It is such a useful app. I would say it is one of the few third party apps I can't imagine using a Mac without now, along with 1Password and Dropbox.

And as it allows you to sync your Macros File using Dropbox it basically means you have your favourite shortcuts and macros on any Mac you use.

1 Like

Did you try karabiner-elements?
They have an Karabiner events viewer where you can check if this key is working

The key is named there application in section PC key/menu

1 Like

Thanks! I have not yet, but I plan to.

No worries, @Zabobon! You've been very helpful regardless.

And, yes, I'm only a couple weeks in and already loving KM.

I have a macro that just executes a right click, displaying the context menu accordingly, when I hit a hotkey. What am I missing?

The part about first moving the cursor to the item that is currently selected, e.g. in Finder, and only then bringing up the context menu.

Gotcha... I gave up on that project a good while back and satisfied myself with macros using the keyboard to quickly move cursor around the screen.

1 Like

Here's a real-case example of where this would be super useful:

In the Music app, when a song is selected there is sometimes a menu option to add that song to a certain playlist. But that option is frustratingly sometimes greyed out depending on what particular mode the app is in. In that case the only way to move the selected song to a certain playlist is to use the right-click menu. But unless the cursor/mouse pointer is hovering exactly over the selected track right-clicking won't bring up the context menu. Nor will any macro to simulate a right-click. This is why it would be so useful to be able to invoke the context menu for a selected item whether the mouse is over that item or not.

However, it looks like it is simply not possible on a Mac to do this (apart from by using @eurobubba AppleScript and that only works for the Finder).

1 Like

For whatever it's worth, it should be possible to write similar scripts using GUI scripting for other applications. I've never gotten around to trying this particular functionality with any others, though, and I won't have time to try any time soon. If you don't want to dig into it yourself, it might be worth trying the Script Debugger forum, where probably the savviest AppleScripters around these days hang out.

1 Like