I’m trying to write a script which can get the path to any document that is just open in any application without using the special dictionary of of this application.
I have to write a log of every action of the logged-in user including a list of all applications and all open windows. I know how to do this with “system events” but there is just the class window without any path to the open document!
Anybody any idea?
It can’t be done purely generically.
AppleScript requires the dictionary of each application in order to query at that level of detail.
Additionally, not all applications support a document model - for example there’s no such thing as a document on disk as far as Safari is concerned.
About the best you can do is write a general handler and use a try block to trap the applications that don’t support it or that follow a different definition:
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
I thought about that solution too but it’s too insecure - if there’s an app with a totally different syntax there’s no chance for me!
But what do you think about this: if you hold down the command-key and then klick in the middle of the top of the document window a pulldown with the document path appears.
Do you think this is scriptable in any way?
Does anybody know if it is possible to get a list of all open documents including their paths from OS X, perhaps via a shell command?
Maybe then it would be possible to solve this problem!