Hiding the modifier keys when stuffing keystrokes
Hiding the modifier keys when stuffing keystrokes
- Subject: Hiding the modifier keys when stuffing keystrokes
- From: Jeffrey Mattox <email@hidden>
- Date: Sun, 26 Jan 2003 23:00:50 -0600
I have attached a handler to a particular keystroke (Cmd-F10) that
calls a subroutine in AppleScript. When that keystroke is received,
my program uses "CGPostKeyboardEvent()" or "keystroke" (AS System
Events 1.2 GUI scripting) to stuff some keystrokes.
This works, except that the target application behaves as if the
command key is down. Of course, the command key *is* down because
I'm holding it down as I push F10. But, I want the stuffed
keystrokes to be precessed by the target application without seeing
the command key modifier.
I've tried placing several "key up command" lines in my script just
before sending the keystrokes, but that did not help. I haven't
tried the equivalent using CGPostKeyboardEvent() because I don't know
how to determine the virtual key codes for keys (help would be
appreciated on that, too), but I expect similar problems.
If I insert a short delay just before stuffing and release the
command key before the delay expires, then the stuffed characters are
okay. However, it's not practical to delay, hoping that the user
releases all the modifier keys in the meantime.
So, how can a Cocoa or AppleScript routine stuff keystrokes without
the real modifier keys being seen, too?
Thanks,
Jeff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.