frillo Posted November 5, 2015 Share Posted November 5, 2015 Like I said in Topic Title, I'd like to trigger some Apple services (the ones you call by right-clicking on an item, i.e.). I can't find a way to do this… Thx, Guido Link to comment
deanishe Posted November 5, 2015 Share Posted November 5, 2015 I'm pretty sure you can use AppleScript to simulate a mouseclick on an item in the Services menu, but I don't think there's an API for enumerating installed/active services. Not in AppleScript, at least. Link to comment
RodgerWW Posted November 5, 2015 Share Posted November 5, 2015 Is setting a keyboard shortcut NOT what you are looking for? Because you can do that in System Preferences/Keyboard/Shortcuts/Services. Link to comment
frillo Posted November 5, 2015 Author Share Posted November 5, 2015 Is setting a keyboard shortcut NOT what you are looking for? Because you can do that in System Preferences/Keyboard/Shortcuts/Services. Link to comment
frillo Posted November 5, 2015 Author Share Posted November 5, 2015 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
deanishe Posted November 5, 2015 Share Posted November 5, 2015 So, you want to assign them all keyboard shortcuts in System Preferences and list them in (and run them from) Alfred? Link to comment
frillo Posted November 5, 2015 Author Share Posted November 5, 2015 (edited) 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 November 5, 2015 by frillo Link to comment
deanishe Posted November 5, 2015 Share Posted November 5, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now