In Mac OS / Cocoa, may I synthesize keyboard entries - strings - for the frontmost application in a transparent way?
To be more precise, I don\'t wa
Sure, you'll want to use CGEventCreateKeyboardEvent to create keyboard events, then post them as such:
CGEventRef keyup, keydown;
keydown = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)56, true);
keyup = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)56, false);
CGEventPost(kCGHIDEventTap, keydown);
CGEventPost(kCGHIDEventTap, keyup);
CFRelease(keydown);
CFRelease(keyup);
It's a bit more complicated than AppleScript but it does the trick. You do have to explicitly post a keydown and then a keyup event. More information at the Quartz Event Services Reference.