On 1 Sep 2016, at 20:25, Shane Stanley <email@hidden> wrote:
Cocoa won't let you go fiddling with another app's stuff (fortunately).
Good point. Sometimes my Applescript head and my Cocoa head pass each other in the corridor without barely a glance of recognition or acknowledgement.
But it isn't true.
Several Cocoa frameworks from Apple whose names begin with "NSAccessibility" make an application's user interface elements available to other applications as accessibility objects. Many of Apple's Cocoa frameworks, such as NSWindow, NSButton, etc., use these NSAccessibility frameworks to make every standard Cocoa application's windows, buttons, etc., available to assistive applications for computer users with disabilities. While it is true that assistive applications are generally written using the non-Cocoa Core Foundation accessibility API in the ApplicationServices framework, nothing prevents you from using that API to write a Cocoa application that controls other applications.
In fact, my PFAssistive Framework is an Objective-C framework based on Apple's Cocoa frameworks and Core Foundation, and it can be used to write an assistive application that controls other applications. And my UI Browser application, which is written in Objective-C based on Apple's Cocoa frameworks, is an assistive application and uses my PFAssistive Framework. UI Browser, like Apple's similar Accessibility Inspector application, exists precisely to "let you go fiddling with another app's stuff."
|