可可问题:如何为最前面的应用程序获取当前打开文档的文件路径 [英] Cocoa question: How to get file path for current open document for the front most application

查看:80
本文介绍了可可问题:如何为最前面的应用程序获取当前打开文档的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以获得最前端的应用程序,如何获得最前端文档的路径?

I can get the front most application, how do I get the path for the front most document?

推荐答案

对于任何应用程序都无法做到这一点.应用程序并不总是具有文档.如果应用程序支持标准的AppleScript文档模型,则可以使用AppleScript做到这一点.例如

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

这篇关于可可问题:如何为最前面的应用程序获取当前打开文档的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆