cocoa - Converting NSString to keyCode+modifiers for AXUIElementPostKeyboardEvent -
edit: turns out, misled during initial explorations of accessibility apis. once found secure text field in ax hierarchy, able set value. not sure question beyond that, wanted update future searchers.
i'm working on code post keyboard events targeted applications using accessibility apis. far, have been able write trivial app allows me type in string value , post keyboard events key codes targeted application. in reality, strings read location.
what have not yet been able figure out how ascertain whether , modifier keys should posted. instance, when type hello, world!
test application, input sent other application hello, world1
because not yet including modifier keys create upper case h , exclamation point. made doubly complicated multi-keystroke characters é
or ü
. sending é
sends raw e
no accent example.
is there simple method overlooking discerning modifiers combine keycode creating particular nsstring or unichar? if not, have suggestion of how proceed? far, best have come calling uckeytranslate
possible modifier combinations until find 1 matches unichar
using -[nsstring characteratindex:]
i'm not sure scalable or reliable, though, given multi-keystroke nature of characters noted above.
thanks in advance!
this won't help. in case: necessary send keyboard events? because going difficult if need support, say, kotoeri.
it's simple matter override inserttext: , docommandbyselector: , send results of key sequence, rather individual keystrokes.
Comments
Post a Comment