Hi there,
Has anyone had any luck simulating key strokes with CGEventCreateKeyboardEvent on OS X.
I am trying to make an app that simulates key strokes and a little bit lost.
I think CGEventCreateKeyboardEvent is available through ApplicationServices.framework, but I can't figure out how to get it to do something.
I have tried hacking the events example, and thought that adding this line (below) might simulate a keystroke to the screen when I click the mouse.
It compiles ok, but does not do anything....
Any tips on how to do this would be really appreciated.
Thanks for looking
simon
//--------------------------------------------------------------
void testApp::keyPressed (int key){
sprintf(eventString, "keyPressed = (%i)", key);
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
CGEventCreateKeyboardEvent (NULL, (CGKeyCode)52, true);
}