Re: Programmatically Accessing NSAccessibility Properties of UI Elements
Re: Programmatically Accessing NSAccessibility Properties of UI Elements
- Subject: Re: Programmatically Accessing NSAccessibility Properties of UI Elements
- From: Bill Cheeseman <email@hidden>
- Date: Sun, 20 Nov 2016 05:09:38 -0500
Is that possible to write code in swift that can access UI elements of another app taking advantage of OS X accessibility technology? Xcode has UI testing, but it seems only for the app that you're developing. Also Applescript and JXA can definitely do something like this using System Events, but it doesn't seem to have access to all the NSAccessibility properties.
You should be able to use NSAccessibility, but you can also use the accessibility files beginning with "AX" in the HIServices subframework of the Application Services framework. These are written in C and use Core Foundation types. Swift imports these as Swift classes, as describved in "Using Swift with Cocoa and Objective-C" (Swift 3.0.1).
You can mix Objective-C and Swift in a single project. My PFAssistive and PFEventTaps frameworks are written in Objective-C and wrap Apple's "AX" and Event Taps accessibiilty frameworks. Using my frameworks, you can write assistive applications that control other applications using either Objective-C or Swift. I already have a working version of my UI Browser application written in Swift using my Objective-C frameworks.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden