-
Re: how i can get information from active application in osx
eskimo Nov 28, 2016 1:19 AM (in response to antoxi4)You can get the active app (the one whose menu bar is on screen) using NSRunningApplication. Get the list of all running apps and search for the one whose
active
property is true. You can also use KVO to be notified of changes.If you’re looking for information inside the active app, things get trickier. Specifically:
There’s no general solution to this; you’ll need code that specific to the app you’re targeting.
Many of the techniques are restricted in some way. For example, one common approach is to use the accessibility API to look at UI elements within the app (starting with
AXUIElementCreateApplication
), but that API requires that the user approve your app as an accessibility app (in System Preferences > Security & Privacy > Privacy > Accessibility).
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardwarelet myEmail = "eskimo" + "1" + "@apple.com"
-
Re: how i can get information from active application in osx
antoxi4 Dec 15, 2016 11:49 PM (in response to eskimo)Thanks)))