views:

25

answers:

1

I am writing a desktop usage statistics app. It runs a background daemon which wakes up at regular intervals, finds the name of the application window currently in focus and logs that data in database.

I manage to do this on Linux desktop with help of xprop utility (you can find it here).

How can I do the same on Mac OSX? Is there a direct/indirect way to do this from a python script? (PyObjC?)

A: 

You can do this with AppleScript:

http://stackoverflow.com/questions/480866/get-the-title-of-the-current-active-window-document-in-mac-os-x

You can try using appscript to generate AppleScript events from python.

Matthew Schinckel