【发布时间】:2015-09-16 09:34:23
【问题描述】:
我创建了一个运行 bash 脚本并启动应用程序的 AppleScript
我已将 AppleScript 保存为应用程序
在我的计算机上,bash 脚本运行,该应用程序也运行;但是,在另一台计算机上,AppleScript 无法打开该应用程序,因为它来自身份不明的开发者
有没有办法让 AppleScript 打开应用程序,即使它来自身份不明的开发人员? Oris 有没有办法用 bash 脚本打开应用程序?
我知道如何在 bash 脚本中打开应用程序,但它遇到了同样的问题(未识别的开发人员错误)
我不想更改我的系统首选项。我正在寻找一种以编程方式执行此操作的方法,以便任何用户都可以在他们的机器上运行 AppleScript
如果用户必须“右键单击,打开”最终的 AppleScript 以使 Apple Script 运行,这没关系,它只需要打开脚本正在打开的应用程序,而无需“右键单击,打开”再次
这是我的 AppleScript 代码:
tell application "Finder" to get POSIX path of ((path to me as text) & "::")
set scriptPath to quoted form of result & "BrewInstall.command"
tell application "Finder" to get POSIX path of ((path to me as text) & "::")
set appPath to result & "OracleInstall.app"
tell application appPath
activate
end tell
tell application "Terminal"
activate
do script scriptPath
end tell
【问题讨论】:
-
我相信我想通了。首先,我切换了“告诉块”。在“告诉应用程序'终端'”块内,我执行了一个 shell 脚本,将 cd 指向应用程序所在的目录。然后执行另一个 chmod 应用程序的 shell 脚本
标签: bash scripting terminal applescript