On Jun 16, 2009, at 8:22 PM, Dave DeLong wrote:

I want to take a snapshot of the NSPasteboard, put my own information on it, programmatically invoke a paste operation, and then restore the pasteboard to its original state.

I have this mostly working, but it's not a satisfactory solution. My problem is with posting the CGEvents for a command-v operation. I've found that if I do everything inline (snapshot, replace, paste, restore snapshot), then the restore operation executes before the CGEvent gets processed. It posts just fine, but it seems like the execution of the event is asynchronous.

What if you only put a promise on the pasteboard? When the pasteboard server asks you to fulfill the promise, you can be reasonably certain that it was because the paste operation in the other app is underway. You can fulfill the promise and then schedule the restoration of the original pasteboard contents with a 0 delay (or maybe 0.2, or something).

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to