2
我有以下Applescript可以在Snow Leopard和Lion的applescript编辑器中正常运行。我也可以在Snow Leopard上通过终端使用osascript而不是在Lion上运行它。代码如下为什么我的Applescript在Snow Leopard上使用osascript在终端上运行,但在Lion上却不能运行?
tell application "System Events"
try
get process "Mathematica"
on error -- Not running, launch and run
launch application "Mathematica"
-- May need to wait until application finishes launching
repeat while "Mathematica" is not in name of processes
delay 0.5
end repeat
end try
end tell
tell application "Mathematica"
activate
do script "notebook0=NotebookEvaluate[\"/Users/me/file.nb\"];
Clear[notebook0];NotebookClose[EvaluationNotebook[]]"
end tell
脚本打开并执行Mathematica脚本。它对上述场景很成功,但是当我尝试在Lion中使用osascript运行它时,我得到一个Mathematica窗口,其中声明“请求的文件无法找到或访问”。
非常感谢。