2 Replies
      Latest reply on Dec 15, 2016 11:49 PM by antoxi4
      antoxi4 Level 1 Level 1 (0 points)

        I want track user activity and need getting active tab title from user active application. Like skype. i want get selected user chat tab title. Its possible?

        • Re: how i can get information from active application in osx
          eskimo Apple Staff Apple Staff (13,905 points)

          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/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"