Creating a finder service

G'day

I'm looking for a way to create a service such that when I right click in a folder in finder I get services I've created in Keyboard Maestro.

Like - create file - which throws a dialog for the file with an option to open it.

Currerntly I go up a level, use right click service to create a terminal window, touch <filename.ext>, open <filename.ext>

and instead of going up a level to create a terminal session I'd like to be able to just create a terminal session where I am.

Is this possible with Keyboard Maestro?

IIRC, I did something like that following this guide:

I'm not entirely sure if this is possible. Firstly, Keyboard Maestro doesn't have the ability to intercept mouse clicks. Instead, KM can detect mouse clicks using the USB Device Key trigger, but that's not intercepting the click. Instead, it provides a way to trigger a macro in addition to whatever macOS does when you click the mouse.

That doesn't mean it's impossible. But you may have to make some big compromises/complexities to make this work.

But I don't think you are using the right tool here. Doesn't macOS's Automator application provide for "services" to be added to the "Finder" app? I think Automator calls them "Quick Actions." But it sounds like Automator is specifically designed to solve your problem. I recommend that you launch Automator and try creating a Quick Action.

I'm not the sharpest person on this website so I could be wrong. Hmm, I see that Juan just referred you to a long web page that shows that it is possible. Good luck. I still recommend that you look into Automator which seems to be designed to solve your problem. EDIT: I see an even more important comment from Peter himself, so I guess I was wrong.

1 Like

File ➤ Export as Finder Quick Action

Select a macro, and export as a quick action.

4 Likes

On the Podfeet blog it mentions the importance of having the trigger set correctly.

@peternlewis Just to clarify here. How should the trigger as a minimum be set up for this to work.
Seems Status Menu Item is not enough.

I don't remember "triggers" being important. IIRC, the macros I set up as Quick Actions didn’t include any triggers.

BUT... if you want to do something with the "current finder selection", you'll need to use the %TriggerValue% to get its File Path.

1 Like

No trigger is required - the macro just needs to be active.

3 Likes

Note that if you go the Quick Action route you are going to have to right-click something in that folder -- empty space doesn't count. You can spoof it (some of the time) by using the %FinderInsertionLocation% token in your macro so that when you run it through Quick Actions via a right-click on something in a Finder window it will open a new Terminal at the target of that window:

image

2 Likes

Further to @Nige_S suggestion...

I don't use quick actions. Instead, I have a dedicated hotkey that presents a list of possible file actions, based on the type of file selected, and in some cases immediately processes the file (e.g. App - Icon to Clipboard). Same idea, no need for the mouse.

It's very particular to my needs, but here's the idea:

File-Type Actions.kmmacros (47 KB)

Macro screenshot

Each of the Trigger Macro By Name actions opens a list of macros from a Smart Group. As an example, all my image file-action macros are named with "Image -" as a prefix, and as such, appear in the Smart Group.

This means that if I have an image file selected in the Finder, I can hit my hotkey and choose one of my image processing macros.

4 Likes

I'm still digesting this but I've just created my first text service based on this thread.

File > Export > Export as Text Service...

Cheers

Keith