Bash脚本调用AppleScript错误
我有两个脚本,第一个是bash,第二个是macOS 10.14 mojave上的AppleScript。我正在从Bash调用AppleScript,结果出错。如果我直接运行AppleScript,它将毫无问题地运行 若我运行bash脚本来执行AppleScript,我将得到对话框“错误:找不到应用程序标识符” 若我在脚本编辑器中运行AppleScript,它将在对话框中显示正确的(org.mozilla.firefox)应用程序标识符 为什么在运行bash脚本执行AppleScript时不显示应用程序标识符。 Bash脚本:Bash脚本调用AppleScript错误,bash,shell,applescript,macos-mojave,Bash,Shell,Applescript,Macos Mojave,我有两个脚本,第一个是bash,第二个是macOS 10.14 mojave上的AppleScript。我正在从Bash调用AppleScript,结果出错。如果我直接运行AppleScript,它将毫无问题地运行 若我运行bash脚本来执行AppleScript,我将得到对话框“错误:找不到应用程序标识符” 若我在脚本编辑器中运行AppleScript,它将在对话框中显示正确的(org.mozilla.firefox)应用程序标识符 为什么在运行bash脚本执行AppleScript时不显示应
#!/bin/bash
/usr/bin/osascript /Users/mymac/Desktop/tst.scpt
AppleScript:
property IDI : "NOTSET"
try
set IDI to bundle identifier of (info for (path to application "Firefox"))
display dialog " Identifier is " with title "Test" buttons {"Exit"} default answer IDI
end try
if IDI is "NOTSET" then
display dialog "ERROR: Unable to find application identifier." with title "Test" buttons {"Exit"}
return
end if
我无法将两个脚本放在一个脚本中,需要将它们分别放在脚本中。打开Firefox时可能会出现时间问题,而脚本中可能没有考虑到这些问题。尝试将
告诉应用程序“Firefox”激活
和延迟1
添加到applescriptw中,你认为如何?这对我来说是可行的,在macOS High Sierra下没有问题,因此这可能是macOS Mojave特有的问题。