Programmatically invokes a Services menu service.
SDK
- macOS 10.0+
Framework
- App
Kit
Declaration
func NSPerformService(_ itemName: String, _ pboard: NSPasteboard?) -> Bool
Parameters
itemNameSpecifies a Services menu item, in any language. If the requested service is from a submenu of the Services menu, the value must contain a slash (for example, “Mail/Selection”).
pboardThe pasteboard containing the data required by the service. This data must be present for the service to succeed. On output, this pasteboard contains the data returned by the service provider.
Return Value
true if the service was successfully performed or false if it was not.
Discussion
Use this function to programmatically invoke a service found in the application’s Services menu.