Re: Event to trigger writeSelectionToPasteboard
Re: Event to trigger writeSelectionToPasteboard
- Subject: Re: Event to trigger writeSelectionToPasteboard
- From: Peter Watkins <email@hidden>
- Date: Tue, 4 Jan 2011 08:04:51 -0800
Hi Graham,
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.
>
Good to know.
>
> What are you really trying to achieve?
>
This is what I'm really trying to achieve, "I'm writing an app that lets the
user select text in one program and paste it into another by middle-clicking
the mouse button."
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.
>
Hmm... Would this be a better method:
1) Store the contents of the global pasteboard in a temporary variable
2) Send the the Command and "c" CGEvents
3) Retrieve the new contents of the global pasteboard
4) Replace the contents of the global pasteboard with the temporary variable
in step #1
Thanks,
Peter
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden