The only alternative I know is to send a Cmd-c and monitor the pasteboard:
+ (void)sendCommandC
{
CGKeyCode _C = [[DJRKeyboardTools sharedInstance] keyCodeForChar:'c'];
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventRef pasteCommandDown = CGEventCreateKeyboardEvent(source, _C, YES);
CGEventSetFlags(pasteCommandDown, kCGEventFlagMaskCommand);
CGEventRef pasteCommandUp = CGEventCreateKeyboardEvent(source, _C, NO);
CGEventPost(kCGAnnotatedSessionEventTap, pasteCommandDown);
CGEventPost(kCGAnnotatedSessionEventTap, pasteCommandUp);
CFRelease(pasteCommandUp);
CFRelease(pasteCommandDown);
CFRelease(source);
}
That piece of code will post the keyboard event. You'll need a bit more code. These gists of mine can help you to start:
- https://gist.github.com/djromero/7326451 Keyboard events (post a keyboard shortcut)
- https://gist.github.com/djromero/7326432 Keyboard tools (get the right character code)
- https://gist.github.com/djromero/7326400 Monitor pasteboard