Hi all,

I've upgraded to Lion, and my app which sends simulated keyboard presses to
various apps to activate a service cannot send these keyboard presses to
Safari or TextEdit. The keyboard presses are still sent correctly to Xcode,
Finder and Mail. I have also confirmed that they still work fine for Safari
and TextEdit on Snow Leopard.

Has anybody else come across this problem?
Below is a snippet of my code, and attached [1] is a test app I made that
sends ⌘N to various apps.
Please not that
a) the attached code was thrown together in a few minutes, and is not very
elegant
b) I cannot use CGEventCreateKeyboardEvent as I need to send the keyboard
presses to an app other than the front app

pid_t pid = **some pid, verified to be right**

AXUIElementRef app = AXUIElementCreateApplication (pid);

  // Simulating a CMD ESC keypress

AXUIElementPostKeyboardEvent (app, (CGCharCode) 0, (CGKeyCode)55, true );
//Command

AXUIElementPostKeyboardEvent (app, (CGCharCode) 0, (CGKeyCode)53, true );
//Escape

AXUIElementPostKeyboardEvent (app, (CGCharCode) 0, (CGKeyCode)53, false );
//Escape

AXUIElementPostKeyboardEvent (app, (CGCharCode) 0, (CGKeyCode)55, true );
//Command

    CFRelease( app );

[1] http://dl.dropbox.com/u/34827/KeyboardPress.zip
_______________________________________________

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

Reply via email to