1

I'm writing an Automator plugin for OS X that lets you invoke any System Service.

I like to offer a complete list of all available Services to the user, so that he doesn't have to enter their names manually.

Is there an API function that lets me get all the Services? After all, OS X can list the services in the menu, so how does it get this list?

Clarification. I mean these Services:

Services in Finder

Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149

1 Answers1

3

Run following command "pbs -dump" or it's derivates. Also disassembly of this file can tell you a lot "/System/Library/CoreServices/pbs"

Alternative to fetch services is to read:

~/Library/Caches/com.apple.nsservicescache.plist 

pbs

Marek H
  • 5,173
  • 3
  • 31
  • 42
  • 1
    Useful answer but I doubt that's what OSX internally does when showing a list of Services. There must be some internal API for this, and I wonder if it's just not documented by accident or intentionally hidden (and thus unsafe to use). Though, I only knew about the pbs command, and I may try reading the plist instead (and fallback to the cmd if the former fails in a future OS version), so thanks for mentioning that. I had tried disassembling pbs with Hopper but was unsuccessful to find anything relevant to my question. – Thomas Tempelmann Sep 21 '15 at 09:23
  • Trust me, this is what the OS does. There is no public API. You can disassembly AppKit and see it with your own eyes (this is what I did). Thanks to caching it's efficient. – Marek H Sep 21 '15 at 09:31
  • BTW, it was for this project, but I have not yet added the listing of Services as planned: https://github.com/tempelmann/RunServiceActionForAutomator – Thomas Tempelmann Sep 21 '15 at 17:04