小编Ewa*_*noy的帖子

如何从应用程序关闭窗口,传递文件名?

我正在尝试生成一个基于 Applescript 的 shell 命令,该命令告诉 Mac OS X 中的预览应用程序关闭特定窗口。

#!/bin/sh

osascript <<EOF
tell application "Preview"
   close "$1"
end tell
EOF
Run Code Online (Sandbox Code Playgroud)

但这不起作用:我收到错误消息

25:52: execution error: Preview got an error: "musixdoc.pdf" doesn’t understand the close message. (-1708)
Run Code Online (Sandbox Code Playgroud)

相关问题:如何使用 .bash_profile 中定义的别名从命令行关闭 OS X 应用程序?

applescript shell-script macos

10
推荐指数
1
解决办法
2万
查看次数

标签 统计

applescript ×1

macos ×1

shell-script ×1