• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Notification/callback of successful CGEventPost?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification/callback of successful CGEventPost?


  • Subject: Re: Notification/callback of successful CGEventPost?
  • From: Dave DeLong <email@hidden>
  • Date: Tue, 16 Jun 2009 20:35:33 -0600

That, my friend, is a seriously slick idea. I will try that out and report back.

Dave

On Jun 16, 2009, at 7:49 PM, Ken Thomases wrote:

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@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


References: 
 >Notification/callback of successful CGEventPost? (From: Dave DeLong <email@hidden>)
 >Re: Notification/callback of successful CGEventPost? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: to NIB or not to NIB
  • Next by Date: How to fill rectangle under vertical scroller?
  • Previous by thread: Re: Notification/callback of successful CGEventPost?
  • Next by thread: Re: Notification/callback of successful CGEventPost?
  • Index(es):
    • Date
    • Thread