Sunday, September 27, 2020

#1 2020-01-17 01:21:50 pm

markconwaymunro
Member
Registered: 2017-11-28
Posts: 52
Website

Adding a macOS Service to an app

Is this possible? I see a Services area in Xcode but am not sure what to do with it and google searches seem to focus on a user creating a service with automator instead of how to add one to an app. Any clues are welcome.

Offline

 

#2 2020-01-22 11:44:12 pm

TedW
Member
Registered: 2005-11-02
Posts: 66

Re: Adding a macOS Service to an app

As I understand it, it should be possible to make an AppleScript app that provides a service. Automator just makes it a heck a lot easier.

See the Services Implementation Guide: https://developer.apple.com/library/arc … 000101-SW1. You'd have to create an AppleScript app — or possibly you could get by with a script bundle — and edit the info.plist file with the appropriate keys to set up a services menu item and indicate its handler. Then the app would have to be placed in ~/Library/Services for the system to distribute it. If you get the details right it should 'just work,' but I don't have the time to play with it right now.  I'll experiment tomorrow and see what happens.

The trickiest part, I expect, is that data seems to be provided to services through NSPasteBoard, which I personally find annoying to work with. But with some slogging it ought to work out.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)