使用Applescript或Bash Script打开第三方应用程序(来自身份不明的开发人员)

时间:2015-06-29 19:22:11

标签: bash scripting terminal applescript

  • 我创建了一个运行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

1 个答案:

答案 0 :(得分:0)

如果您先删除隔离属性,则应该有效:

执行shell脚本“xattr -d com.apple.quarantine& appPath