I want to make a simple program that sends random keystrokes to my other application (a simple text editor). The purpose is to stress test the other app by feeding it either random letters or a large prepared text.
What I need is a way to convert a character in an NSString to a keycode, so I can pass it to the OS thus:
CGKeyCode code = [self convertLetter:myOneCharNSString];
CGEventRef e = CGEventCreateKeyboardEvent (NULL, code, true);
CGEventPost(kCGSessionEventTap, e);
CFRelease(e);
Any clues?
This will do the trick: