On 01/01/2011, at 6:43 AM, Peter Watkins wrote:

> I know that each Cocoa app implements writeSelectionToPasteboard(), and I'm
> guessing this is how services interact with running apps. Each service is a
> separate short-running process. Sothere must be some sort of IPC to get the
> selection from the running app into the service's pasteboard. If I can
> figure out what that IPC is, I can send a message to a running application,
> and this would avoid flashing the menu bar.
> 
> Any ideas on getting another app to run its writeSelectionToPasteboard()
> method?


Read the Services Implementation Guide:

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/SysServices/introduction.html

The app needs to be written to be services aware, and implement the protocols 
specified in the guide. If not, you can't do what you're doing for any 
arbitrary app. Between the Cut or Copy menu command and data being put on the 
pasteboard, the app can do whatever it wants, there is no 'standard' method 
that gets called and the method names are arbitrary (even the action method 
that responds to the Copy command might not be called -copy:)

There's no 'Copy' or 'Paste' event. Some apps might expose these through 
applescript - again, there's no guarantee.

What are you really trying to achieve? If you implement your service in a 
standard way, apps that are services aware will be able to use it. If not, they 
won't,  and you have to live with it. You can't force an app to become services 
aware if it wasn't written to be.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to