Edit: It turns out I was misled during my initial research on accessibility APIs. Once I found a safe text field in the AX hierarchy, I could easily set the value. Not sure what to do with this question other than this, but I wanted to update it for future search engines.
I am working on some code that will publish keyboard events for target applications using the Accessibility API. So far, I could write a trivial application that allows me to enter a string value, and then send keyboard events with these key codes to the target application. In fact, the lines will be read from another place.
What I still could not figure out is how to determine if and what modifier keys should also be published. For example, when I enter Hello, world! in my test application, the input is sent to another application like hello, world1 , because I still do not include modifier keys to create an uppercase H and an exclamation mark. This is doubly complicated by characters with a few keystrokes, such as é or ü . Sending é sends raw e without an accent, for example.
Is there a simple method that I skip in order to distinguish between modifiers in order to combine with the code to create a specific NSString or unichar? If not, does anyone have a suggestion on how to proceed? So far, the best thing I've come up with is calling UCKeyTranslate with all possible combinations of modifiers, until I find one that matches unichar , I get use -[NSString characterAtIndex:] . I'm not sure if this is the scalable or robust, multi-character nature of some characters, as mentioned above.
Thanks in advance!
source share