Jump to content

How to trigger Apple Services?


Recommended Posts

Yes, it is indeed. And that's exactly what I'm doing right now.

But considering that I need to trigger 15 to 20 services and being lots of Shortcuts already used by System itself, I wanted to keep them neatly ordered, like:

Alfred activation shortcut > 1

Alfred activation shortcut > 2

and so on…

Link to comment

No, I'd like to bypass completely the System Keyboard Shortcuts and trigger them from Alfred.

By the way, the Services themselves are actually triggers to Automator Workflows. So, MAYBE, I could trigger the latter. Would it be easier to accomplish?

Thx,

g

Edited by frillo
Link to comment

No, I'd like to bypass completely the System Keyboard Shortcuts and trigger them from Alfred.

AFAIK, there are 2 ways to do that.

1. Use AppleScript to simulate a click in an application's Services menu.

2. Use the Objective-C API (possibly from another language via a bridge) to run a service.

In both cases, you'd have to specify the service's exact name (there's no way—that I'm aware of—to easily get a list of available services).

 

By the way, the Services themselves are actually triggers to Automator Workflows. So, MAYBE, I could trigger the latter. Would it be easier to accomplish?

Thx,

g

Yes, that would be easier. You can run a workflow by path using open -a "Automator Runner" /path/to/workflow.workflow

 

You could probably adapt my AppScripts workflow pretty easily to work with Automator workflows instead of (or as well as AppleScripts).

 

The problem is that some Automator workflows won't work when not run as services if they get their input via the "Service receives selected XXX in YYY" option in Automator.

 

For any services that require the selected files or text etc., you'd have to replace the input via the services API with a corresponding normal Automator action to retrieve the input, e.g., Get Selected Finder Items.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...