Skip to content

Technical Notes: Accessibility

Alexei Baboulevitch edited this page Jan 20, 2014 · 2 revisions

OSX provides developers with a rich accessibility API that can hook into almost anything. (Check the UIElementInspector code sample for a demonstration.) I thought I might be able to use this API to edit text fields directly for my menu bar app. Unfortunately, some applications — namely, ones that override the native text behavior — can't be queried with the accessibility APIs. (Sublime Text is one such offender.) When I discovered this, I was a bit puzzled: couldn't Services process text from any app, even Sublime and kin? However, after reading the Services documentation, I found out that Services works by requesting a pasteboard directly from the app in question. Good to know!

References

Stack Overflow answer with sample Accessibility code

Clone this wiki locally