• 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
Keystrokes for non-ascii letters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Keystrokes for non-ascii letters


  • Subject: Keystrokes for non-ascii letters
  • From: Dave DeLong <email@hidden>
  • Date: Sat, 29 Nov 2008 09:26:43 -0700

Hey everyone,

I'm working on a client/server application. The client sends tiny "Event" objects to the server that can contain an NSString of a letter or short sequence of letters (up to about 4). What I'm trying to do is figure out how the server can perform the keypress(es) to get that letter (or sequence).

I know that I could use CGEventCreateKeyboardEvent, but that requires me to know the precise keycode for the letter. If I were limited to just ASCII 0-127, that wouldn't be so bad. But I could also be getting things like "é" or "£" and so on. I'd rather not hard code in every keystroke combination. =)

Alternatively, I could try using AppleScript. But in playing around with it, I found that if I do: Tell app "System Events" to keystroke "é", then all it does is type "a". Other tests have shown that the "keystroke" command only accepts basic ASCII characters. Of course I could use the "using command down" to get the non-ascii letters, but again, that would require me to hard code in every keystroke combination.

My last idea is to put it on the clipboard and paste it in by simulating a command-v keystroke. The only problem with this is that command-v doesn't mean paste on all keyboards.

Do any of you have any ideas on how I can type arbitrary UTF8 characters programmatically?

Thanks,

Dave_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Keystrokes for non-ascii letters
      • From: Ricky Sharp <email@hidden>
    • Re: Keystrokes for non-ascii letters
      • From: Eric Schlegel <email@hidden>
  • Prev by Date: Re: Text blurred in application
  • Next by Date: Re: Text blurred in application
  • Previous by thread: Re: displaying huge log files
  • Next by thread: Re: Keystrokes for non-ascii letters
  • Index(es):
    • Date
    • Thread