Is there an app independent way to trigger a services menu item either with selected text (+images) or the current clipboard

The following (snapshot) does not work

A workaround is select text → right mouse click → services, etc but it is not very elegant.

Thanks in advance for your time and help

That is close to what you want. Just change the Menu Title field to

^APPLICATION

and the macro should work across applications.

1 Like

Pardon my ignorance but what does specifying ^APPLICATION do? (I feel I’m going to learn a whole new area of Keyboard Maestro here.)

I certainly would not have the brains to figure it out. The brilliant @gglick showed me.

How to Trigger an App Independent Services Menu Item

thank you for your reply. Strange: does not work.
Below are snapshots of non working macro and services menu
I tried in multiple apps
thanks again

image

image

I certainly would not have the brains to figure it out. The brilliant @gglick showed me.

How to Trigger an App Independent Services Menu Item

sorry for the bungled multiple replies

The reason my demonstration worked and your replication didn't is we have different symbols used.

Mine: ^
Yours: ⌃

But you've got the macro working, that's what counts.

1 Like

thank you. It works now. My apologies for the confusion.

So, is this the character for anchoring a RegEx match to the start of a string? (The referenced thread doesn’t contain ^APPLICATION but only APPLICATION.)

@NaOH @MartinPacker
after an initial bout of enthusiasm, I am totally confused.
Adding a ^ before APPLICATION worked once but it was a fluke. It certainly does not work consistently. In addition, using APPLICATION without the ^ has worked in multiple apps today, but not consistently.

Hey Folks,

KM-Wiki ⇢ Select or Show a Menu Item action.

APPLICATION is correct.

^APPLICATION is not correct.

The caret character is Shift-6 on US keyboards.

The lack of consistency is explained in the Wiki:

  • APPLICATION expands to the front application name, and the name the macOS sees may NOT be the same as is displayed in the app menu.

For instance: Google Chrome.

The app name is Google Chrome – the app-menu is named Chrome.

Therefore to use the generic app token and include Chrome you must do this:

APPLICATION|Chrome

Note the pipe character OR separator.

-Chris

2 Likes

Thank you very much cc!

I tried it out and it now works. Using the app menu name : I learned something new!

I would have 2 questions:

  1. What would be the syntax be to include multiple problematic apps, for example Chrome, Scrivener, DevonThink ?
    In other words, how would I add Scrivener and devonthink to
    APPLICATION|Chrome

  2. Scrivener includes a scratchpad function which an extremely useful RTFD note-taking app. As long as Scrivener is open, even in the background, I can type ⇧⌘Enter in any app and the scratchpad floats onto the screen (slides over part of the screen from the right)
    I am trying to get the services menu macro to work in the scratchpad but it won't, even when I tried APPLICATION|Scrivener. I know from reading the keyboard maestro forum that these hybrid “sub apps” are difficult to deal with. Would you have any idea ?

Thanks again very much.

Hey @ronald,

APPLICATION|Chrome|Scrivener|DevonThink

I just tried with Scrivener 3.0 on macOS 10.12.6, and I can't get anything in the Services menu to work with the Scratchpad. They only see the app behind the floating scratchpad window.

In my opinion you're better off using a full-fledged app that's scriptable like Jedit Ω.

It's not integrated with Scrivener, but you should be able to make it play nice with some Keyboard Maestro macros and AppleScript.

BTW – on my system APPLICATION works just fine with Scrivener.

-Chris

A few years ago I made an Automator Action that can invoke a Service. That should be more direct because you do not have to meddle with the menu.

See here: http://blog.tempel.org/2015/09/RunServiceForAutomator.html

1 Like

I downloaded and tried your automator action but I am stuck because I don't know how to use it.

basically, in 99% of cases, I select text +/- images → context menu → services → choose a service menu item.

I tried selecting text → run your automator action as an app and I get an error message.

Please note that I am a moron, so the problem is completely with me.

  • would your action work in the context of selected text?
  • I don't understand what to choose for input, output and options.

sorry for taking your time and thanks very much for your post and automator action.

yes, you are right . worked with Scrivener from the start. sorry.

I looked at the Jedit Ω. site. Very nice features !!

It's not clear if Jedit can handle text + images. Basically all I do is RTFD - text + images

can one float the Jedit window on top of any app ?

thanks very much for everything including taking the time to test with Scrivener

Ronald, I assume you replied to my tool, it's hard to tell in this forum system.

Before I go further, please tell me which macOS version you're using. And it's Keyboard Maestro v9.2, I assume?

Here's what I did to test if the Action works at all (macOS 10.13.6):

  1. I open Automator, create a new document and choose "Service" (in macOS 11 it's called "Quick Action").
  2. I add the installed "Run Service" to the workflow.
  3. I enter a service name, eg. after I've installed my own app "Find Any File" (apps.tempel.org), I enter: "FAF: Find Name". I leave all other options in their default state (e.g. "Workflow receives current Automatic (text) in any application"). I press the TAB key to make sure that the entered service name is accepted (if I don't, it often keeps using a previous entered name!).
  4. I save it as "Test1.workflow".

Now, I open TextEdit, type some text, select it, and right-click on the text. The Services offers are, amoung others:

  • FAF: Find Name
  • Test1

First, I make sure the immediate service works, so I choose "FAF: Find Name" and I see that it works: FAF gets opened and has the selected text entered as the search text.

Then I repeat, this time choosing the "Test1" service. Since the Test1 workflow basically does the same, i.e. it sends its input (the selected text) to the "FAF: Find Name" service, it also works with the same result. This proves that the action works.

Then I tried the same with an action from DEVONthink 3:

I changed the service name in the Test1.workflow to "DEVONthink 3: Summarize" (and pressed the Tab key afterwards), then saved the workflow.

Then I did the same tests as before: First, select some text, right-click, and choose the "DEVONthink 3: Summarize" service. Which works. Then again, I choose the "Test1" service.

Surprise: This gives me an error, saying that the service could not be invoked. Not the same as your error msg, though.

However, why would it fail with DEVONthink when it worked with my app?

The resolution can be found by looking into the app's "Info.plist" file. There' the service, at least for me, is not called ""DEVONthink 3: Summarize" but "DEVONthink Pro: Summarize"! And that's the name one must enter as a service name for the "Run Action". Once I fixed that, the "Test1" action works.

So, please try this, too: Change the service name from "DEVONthink 3" to "DEVONthink Pro" and see if that helps.

1 Like

thank you very much for the detailed note !! I have not managed to make it work, but I will when I have more time over the weekend. I greatly appreciate all your time and expertise.

Not a problem.

No, and that's an advantage.

Make a Keyboard Maestro macro to activate a certain Jedit window, and go-to-town.

H to hide it again.

And you can script it.

-Chris