Notification/callback of successful CGEventPost?
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