Cocoa question: How to get file path for current open document for the front most application
问题 I can get the front most application, how do I get the path for the front most document? 回答1: There isn't a way to do this for any app. Apps don't always have documents. If an app supports the standard AppleScript document model, you can do it with AppleScript. For example, tell application "TextEdit" set foo to the path of the first document end tell 来源: https://stackoverflow.com/questions/5976152/cocoa-question-how-to-get-file-path-for-current-open-document-for-the-front-mos