On Snow Leopard the third party services are disabled by default. Is there any way to enable it programmatically? I tried with NSRequiredContext and also by editing pbs.plist programmatically as given in following post How do I automatically activate an item in the OS X Services Menu , NSServices not working but its not working for me.
Asked
Active
Viewed 339 times
1 Answers
1
I had some trouble getting this to work in my application as well. When debugging this try calling NSUpdateDynamicServices()
when your app launches and make sure you are registering a service provider. The problem could be that your service isn't getting registered at all. You can use terminal to see which services are registered with /System/Library/CoreServices/pbs -dump_pboard
Example service:
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Open with app</string>
</dict>
<key>NSMessage</key>
<string>processService</string>
<key>NSPortName</key>
<string>MyApp</string>
<key>NSRequiredContext</key>
<array>
</array>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
<string>NSRTFPBoardType</string>
<string>NSURLPBoardType</string>
</array>
</dict>
</array>

Alex Zielenski
- 3,591
- 1
- 26
- 44
-
I am able to see my service in terminal and also in system preferences --> Keyboard --> services. but it is not checked by default. I want to enable it by default like mail service. – Parag Bafna Nov 28 '11 at 05:31
-
OK. I updated my post containing an example of a service in my app that is enabled by default. – Alex Zielenski Nov 28 '11 at 05:47
-
its working now with NSApplicationIdentifier key inside NSRequiredContext Dict. – Parag Bafna Nov 28 '11 at 10:32