views:

1748

answers:

1

Is there any way to use AppleScript (or something else) to query currently running applications for the filename and path of the current file that they have open? I know some applications show the filename in the window title which is script accessible, but this isn't a solution as not all do, and hardly any show the path. I also know this is complex because not every application is document based.

Any suggestions on how to find the currently opened file/path in running Mac apps would be appreciated. Thank you!

+3  A: 

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/lsof.8.html

Paul Betts
This is good - I was just playing with lsof which nicely enough comes with OSX. I suppose I'd need to actively monitor it or hook into some kind of monitor though, as many applications appear to load data into memory and then release the file, making it not appear in lsof. Thank you for the tip.