开发者

Why AppleScript display dialog behaves so differently between Editor and Automator?

For instance, why this script works on AppleScript Editor but not 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开发者_StackOverflow社区"} default button 3 with icon caution

Commenting out everything after the title just on Automator, this is the difference I get:

Why AppleScript display dialog behaves so differently between Editor and Automator?

I want the title and more than 3 lines if possible, but those are not the only weird inconsistent behaviors I've seem in the past hour about applescript between editor and automator. The icon is another one.

In the instance, the error I get for trying it in Automator is this:

Why AppleScript display dialog behaves so differently between Editor and Automator?

Recording, questions here are:

  1. Why? Why oh Apple, why?
  2. Any way to at least make the title work?


The cause of the problem is that Automator imports the terminologies of Applescript Studio, which redefines redefines display dialog as part of the Panel Suite; that version doesn't have the with title parameter. You can check that by opening Automator using the Applescript editor. (Use File→Open Dictionary...) I agree that this is a stupid decision by Apple :(

You can circumvent this problem by using

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

from inside Automator; this tells Applescript's compiler to make the display dialog command call the standard definition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜