Using the accessibility API, I am drilling down through a series of elements and finding a specific AXUIElementRef I am interested in (all in an external application). How do I check if this element currently has keyboard focus? And if not, how do I set it?
Something similar to using AXUIElementSetAttributeValue to set the kAXMainAttribute to true (this works for a window - thanks Peter!).
PS - I have tried kAXFocusedAttribute, doesn't seem to do the job. Maybe it's read only?