Is It Possible to Trigger a Macro in Regular Right-Click Context Menu?

Is it possible to have a trigger while right-clicking on whatever element that provides a context menu? In other terms: can I add KM triggers to the regular right-click context menus the mac os provides (system-wide or per application)?

1 Like

Hi @Bego,
Do you want to use KM to add additional elements to an existing MacOS Context menu? Not that I'm aware of.

You can add additional Services using Automator.

If you need some advanced KM customization, check posts by @appleianer, he/she is very knowledgeable in terms of integrating KM with others apps.

1 Like

Too bad, this is what I thought. Would be very useful, though. Thanks for the quick reply!

1 Like

Hello @Bego, welcome to the KM community.

When I started with KM, it was also my goal to extend the macOS context menu with actions.

KM offers you the possibility to create a (conflict) palette. In this palette you can bundle the KM actions that are important to you for an app.
The palette can be limited to the respective app, so that you only need one trigger (shortcut etc.) for many apps.

So you create your own context menu for each app. Here is an example of how I work with a palette and sub palettes in the Snagit app.

2021_03_18_Support_1

I myself use Touch Gesture with the BetterTouchTool app to call up my palettes. This way I don't need to create any shortcuts and I also prevent overlapping.

5 Likes

A system-wide Service available in the macOS Context Menu to launch a Keyboard Maestro Macro is doable. With a Macro ready to use, go to the Macro option to find the Macro Script ID/AppleScript code. Example:

image

Next, open Automator, make a new Service, then use the Run AppleScript action to have an AppleScript that launches a Keyboard Maestro Macro. Like so:

image

Save the Service and it should be available from the Contextual menu, perhaps in a Services submenu.

Personally, I prefer a setup more like appleianer has demonstrated, but there is no correct approach. More important I think is how each person uses a computer and will best be able to remember the available options.

3 Likes

Hello @Bego,

Yes, it is possible to use the contextual menu directly without going through a sub-menu! After a long search I found one of the few programs that allows this! It is PowerMenu from Fiplab (9,99$ but worth it) : https://fiplab.com/apps/power-menu-for-mac
Then you just have to uncheck the submenu in PowerMenu and add a "Custom script" by copying and pasting the shell command provided by the macro in "Triggered by Shell script".

:wink:

1 Like

Hey @Chris06 - that looks interesting but it only works in Finder according to the website. Is that correct?

I confirm. For the Finder only, as indicated on the site.

1 Like

Thank you, appleianer! Mostly understood. I just have the problem, that on the line "The hot key _____ is pressed", KM seems to expect a KEY (!) to be pressed. Just "click" seems not to work; in other words, the line cannot be activated (not possible to have the white "v" in blue at the beginning of the line) without defining a KEY.

Which leaves me with still having to press at least one key, instead of just a mouse click (any type of mouse click, except 'left mouse click', would do (I am working with a mouse, not trackpad).

What am I missing?

Not sure if you are still interested in getting this working, but it did work for me when I reduced the AppleScript to this:

tell application "Keyboard Maestro Engine"
	do script "C9B77B1A-13D6-43B8-A3B3-C72D9964B5AE"
end tell

I am now able to right-click a file in the finder and see the action under Quick Actions. Choosing it then runs the Keyboard Maestro macro.

Here are some resources that helped:

Making a Systemwide Service

How to make an applescript into a service?

Hi @appleianer I know this is a very old post, but could you please share this Snagit Macro? it looks very useful, thanks!

1 Like

Hi @Ctrl-Dopamine do you mean the complete KM palette from the video or a specific KM macro that is executed in the video?

Wow this was fast @appleianer, I'm glad you are still active in the forum!

I'd like to have a complete KM palette as example (I see yours has numbers and dividers which is cool) so that I can start to use it for other apps (e.g., I'd love to use it in Safari when I select certain test and then I activate the palette to show a list of specific macro to take action including as input the selected text)

Thank you!

Hi, I wrote you a DM.