为什么AppleScript显示对话框在Editor和Automator之间的表现如此不同?

时间:2011-01-10 10:55:57

标签: applescript automator

例如,为什么此脚本适用于 AppleScript编辑器但不适用于 Automator

display dialog "a lot of text just to break to line 4 whatever continuing... few more... argh... there!" with title "just a test" buttons {"Cancel", "Uninstall", "Continue"} default button 3 with icon caution

在Automator上评论 title 之后的所有内容,这就是我得到的差异:

alt text

如果可能的话,我 标题以及 3行,但这些并不是我看来的唯一奇怪的不一致行为关于编辑器 automator 之间的AppleScript的过去一小时。图标是另一个。

在实例中,我在Automator中尝试的错误是:

Syntax Error

录制,问题如下:

  1. 为什么?为什么哦,Apple,为什么?
  2. 至少使 标题 有效吗?

1 个答案:

答案 0 :(得分:9)

问题的原因是Automator会导入terminologies of Applescript Studio,重新定义display dialog作为Panel Suite的一部分;该版本没有with title参数。您可以使用Applescript编辑器打开Automator来检查。 (使用文件→打开字典...)我同意这是Apple的一个愚蠢的决定:(

您可以使用

解决此问题
using terms from application "Finder"
    display dialog "a lot of text just to break to line 4 whatever continuing... few more... argh... there!" with title "just a test" buttons {"Cancel", "Uninstall", "Continue"} default button 3 with icon caution
end using terms from

来自Automator;这告诉Applescript的编译器使display dialog命令调用标准定义。