如何使用AppleScript退出文件窗口?

发布于 2025-02-08 11:28:06 字数 190 浏览 1 评论 0原文

我想使用AppleScript退出文件窗口。

示例:想象一下foo.rtf已打开,我想使用以下脚本

tell application "Finder" to quit "/Users/xyz/Desktop/foo.rtf"

结果退出应用程序: 而不是退出文件,而是退出查找器,而不是文件

I would like to quit a file window using applescript.

Example: Imagine foo.rtf is opened, I want to quit the app using the following script

tell application "Finder" to quit "/Users/xyz/Desktop/foo.rtf"

Result:
Instead of quitting the file it quits Finder but not the file

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

偏爱自由 2025-02-15 11:28:06
  1. 窗口不响应退出,窗口响应CLOSS
  2. Finder不是RTF文件的目标应用程序,您必须告诉目标应用程序以关闭窗口。但是,仅当目标应用程序具有包含窗口元素的applescript字典时,才能有效。如果不是,您可以使用系统事件和GUI脚本关闭窗口。
  1. A window does not respond to quit, a window responds to close.
  2. The Finder is not the target app of an RTF file, you have to tell the target app to close the window. However this works only if the target app has an AppleScript dictionary containing a window element. If not you can close the window with System Events and GUI scripting.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文