Yep:
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); CGEventRef pasteCommandDown = CGEventCreateKeyboardEvent(source, (CGKeyCode)9, YES); CGEventSetFlags(pasteCommandDown, kCGEventFlagMaskCommand); CGEventRef pasteCommandUp = CGEventCreateKeyboardEvent(source, (CGKeyCode)9, NO); CGEventPost(kCGAnnotatedSessionEventTap, pasteCommandDown); CGEventPost(kCGAnnotatedSessionEventTap, pasteCommandUp); CFRelease(pasteCommandUp); CFRelease(pasteCommandDown); CFRelease(source); (CGKeyCode)9 is the code for the letter 'v', so this is the way to invoke a cmd-v (paste) operation. Beware of international keyboard layouts. Cheers, Dave On Jan 5, 2010, at 2:58 PM, has wrote: > > On 5 Jan 2010, at 21:41, Jesse Grosjean wrote: > >> Last, how would I go about sending Cmd-C/Cmd-V keystrokes directoy to >> another application? > > Haven't done it myself, but I would guess CGEventCreateKeyboardEvent() and > friends would be simplest.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com