python - Get the title of the current active Window/Document in Mac OS X -


When asked first, I would like to know how to get the title of the current active document.

I tried writing in the answer to the above question. It works, but only gives me the name of the application. For example, I am writing this question: When I burn a script, I name the application, i.e. "Firefox" It is very clean but does not really help. I would like to capture the title of my current active document View Image

I am using Leopard, so no backward compatibility is necessary. Apart from this, I am using Python AppKit so that I can access the NSW Verb Class, but if you tell me the purpose-coded code, then I can find out the translation in Python.


Well, I have found a solution which is not very satisfied, that is why I do not mark the answer of Koen Boke. At least not yet.

  Let the application know "system events" first set the front-end in the name of application process, with the biggest true end, tell that apply to the application if the number of windows is not 0 set  

Save as script and open it with OSScript.

As far as I know your best bet is wrapping an AppleSpip. But Apple script is magic for me, so I leave it as an exercise for the interpreter :-)

It can help a bit:


Comments