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:
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:
Recording, questions here are:
- Why? Why oh Apple, why?
- 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.
精彩评论