• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Hiding the modifier keys when stuffing keystrokes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: [OT] AppleScript scripts versus Shell scripts
  • Next by Date: Re: returning math answers given a string
  • Previous by thread: Re: Automatically sort a list ?
  • Next by thread: Concatenating records
  • Index(es):
    • Date
    • Thread