Keystrokes for non-ascii letters
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