Skip navigation.
 
mlKeystrokes for non-ascii letters
FROM : Dave DeLong
DATE : Sat Nov 29 17:26:43 2008

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_removed>)

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/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlKeystrokes for non-ascii letters Dave DeLong Nov 29, 17:26
mlRe: Keystrokes for non-ascii letters Eric Schlegel Nov 29, 17:58
mlRe: Keystrokes for non-ascii letters Ricky Sharp Nov 29, 18:41
mlRe: Keystrokes for non-ascii letters Dave DeLong Nov 29, 19:00
mlRe: Keystrokes for non-ascii letters Bill Bumgarner Nov 29, 19:34
mlRe: Keystrokes for non-ascii letters Dave DeLong Nov 29, 19:48
mlRe: Keystrokes for non-ascii letters Jean-Daniel Dupas Nov 29, 19:50
mlRe: Keystrokes for non-ascii letters James W. Walker Nov 29, 21:27
mlRe: Keystrokes for non-ascii letters Dave DeLong Nov 29, 22:03
mlRe: Keystrokes for non-ascii letters James W. Walker Nov 29, 23:10
mlRe: Keystrokes for non-ascii letters (SOLVED) Dave DeLong Nov 30, 01:02
mlRe: Keystrokes for non-ascii letters (SOLVED) Jean-Daniel Dupas Nov 30, 11:58