• 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
Re: sending key presses to another app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sending key presses to another app


  • Subject: Re: sending key presses to another app
  • From: "Jonathan 'Wolf' Rentzsch" <email@hidden>
  • Date: Mon, 3 May 2004 00:26:13 -0500

justin webster, email@hidden, wrote:
>How do I specify the application I'm sending to.

It sends to the front-most app.

>How do I find the values for the particular keys I want to press?

Read up on your virtual keycodes:

<http://developer.apple.com/documentation/mac/Text/Text-571.html>

By the way, CGPostKeyboardEvent() is somewhat buggy. For example, it will
fail in interesting ways if the user is holding down a modifier while
you're fake typing. Also, watch out for virtual keycodes that appear on
the numeric keypad. After posting one of those, it likes to keep the NUM
LOCK bit stuck on. Randomly. Add short delays while autotyping as
CGPostKeyboardEvent() likes to throw away incoming characters if they
come too fast. "Too fast" unfortunately isn't documented anywhere --
you'll need to empirically work that out yourself.

| Jonathan 'Wolf' Rentzsch http://rentzsch.com
| Red Shed Software http://redshed.net
| "better" necessarily means "different"
_______________________________________________
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.


  • Prev by Date: Re: OT? Why are list archive search results so lame?
  • Next by Date: Registering my app as a URL scheme handler
  • Previous by thread: Re: sending key presses to another app
  • Next by thread: Registering my app as a URL scheme handler
  • Index(es):
    • Date
    • Thread