Problems With a Macro Using the Services Menu

Hello,

I wrote a one action macro to print selection from the services menu and do not understand why it does not work (error message below).

Thanks in advance for your time and help.

2021-09-23_09-06-39

image

You might be better off selecting the specific application in the "Select 'Print Selection'" action, since right now it's pointed to whatever application is at the front. This means that if the app you are trying to print from is not at the front, the macro will fail.

The best way to use the select a menu item action is to click the drop down titled "Menu" on the right hand side, and navigate through the menu hierarchy there, since it will auto-populate the fields exactly as the names are written. This prevents typos, and issues with tricky characters (like ...). See the attached screenshot below to see what I'm referring to.

Doing it this will will also have it select the appropriate application automatically in the left-hand dropdown which in your macro is currently set to "Front Application".

-Chris

2 Likes

Thank you for your post and suggestion.

There is perhaps a misunderstanding.

  • Print selection is in the services menu of the context menu.

  • Since the objective of the macro is to print selected text, the app is always at the front.

  • Since the application is always at the front, I used both Select Menu in Front Application and APPLICATION in caps as Menu Title as explained to me by @ccstone and @gglick in this post
    How to Trigger an App Independent Services Menu Item

  • It would be a bit tedious to write an extensive if then else macro to cover all applications in which I want to use select text > print selection.

Hey @ronald,

The problem is that Apple is irresponsible.

Although you can assign keyboard shortcuts to items in the services menu with the macOS System Keyboard Preferences, the assigned hotkeys frequently don't work unless you've opened the services menu at least once since booting to get it populated, cached, and recognized by the system.

This is a completely unbelievable oversight that's existed for years if not decades now.

Not fixed! BAD Apple!

Your solution is to prefix your menu selection with another select-menu action that OPENS the Services menu.

This makes your macro a trifle clunky, but it works and is way faster than selecting the service by hand.

-Chris


Open the Services Menu V1.00.kmmacros (5.1 KB)
Keyboard Maestro Export

2 Likes

OK thanks very much
Some Service menu items are only present in the context service menu, not the top menu

Ah, I see. You didn't mention you were using the Contextual Menu, and I didn't look closely enough at your posted image to realize it was the CM and not the Application > Services Menu.

I assumed, because you were using a Select or Show a Menu Item action.

Keyboard Maestro's Select or Show a Menu Item action does NOT support the Contextual Menu.

To drive the Contextual Menu you'll have to use type-ahead or AppleScript UI-Scripting.

-Chris

1 Like

OK thanks very much

1 Like

Hi @ronald, I think I remember that you are using BetterTouchTool.
There you have the possibility to call actions from the context menu (right click).

Try this out.

3 Likes

nice to hear from you !
excellent !! thank you very much. Works perfectly with a few minor adjustments
Using only your macro, I navigate to print selection append, and the menu item is not triggered, but this is only a minor detail. I greatly appreciate your help

Would you remember by any chance how to trigger a BTT action with KBM ? thank you

I notice that print selection always appends to the previous selection. Do you have that problem ?

@ronald please select your trigger in BTT (blue here) and then run the attached KM macro.

07)UUID AS <B85F 210929T212319>.kmmacros (25,2 KB)

07)UUID AS <B85F 210929T212319>

You then only need an "Execute AppleScript" action in KM and voilà :wink:

3 Likes

I do not use this action. I had created this only as an example for you.

Thanks very much!

1 Like

Very kind of you. Thank you.

1 Like

May I ask you how you type an app shortcut containing brackets on a German keyboard?

Example: [

Thank you

Examples:

image

Hi @ronald, on a German keyboard you press ⌥ + 5 / 6

1

2 Likes

Thanks very much!

1 Like

And thank you for taking the time to make the video!

2 Likes

Wowl.. Thanks CC!

I was struggling with this for so long... After a fresh boot my macro that uses the Services menu would not work. I cancel the macro and run it again and then it works every time. Until I reboot...

You and this forum are fantastic!

2 Likes