• 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
Notification/callback of successful CGEventPost?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Notification/callback of successful CGEventPost?


  • Subject: Notification/callback of successful CGEventPost?
  • From: Dave DeLong <email@hidden>
  • Date: Tue, 16 Jun 2009 19:22:43 -0600

Hey everyone,

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.

My unsatisfactory solution is to put "sleep(2);" in between the paste and restore phase. This works, but I'm not happy with it. What I'd really like is some sort of notification that my event has actually posted so that I don't have to use the sleep command. Is there a way to do this? I know that I could also use a CGEventTap and watch for my event to pass by myself, but is there a better alternative?

Thanks,

Dave DeLong
_______________________________________________

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


  • Follow-Ups:
    • Re: Notification/callback of successful CGEventPost?
      • From: Peter N Lewis <email@hidden>
    • Re: Notification/callback of successful CGEventPost?
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: CoreData and ArrayControllers
  • Next by Date: Re: Notification/callback of successful CGEventPost?
  • Previous by thread: Detecting Threading Design Errors in Core Data
  • Next by thread: Re: Notification/callback of successful CGEventPost?
  • Index(es):
    • Date
    • Thread