1.4. An AppleScript Command to Display a Dialog
Your first program shows the result of the expression evaluation in the Result pane. You use this Result pane (and the Event Log pane) to examine results throughout this book. However, to create an AppleScript program to talk to the user or to interactively display information, you need to do more. The simplest way to do this is to use an AppleScript command called display dialog.
For your second program, you put up a dialog box that says Programming in AppleScript is fun. If you still have your first program open in Script Editor, close the window by selecting File Close or by simply clicking the red dot in the top-left corner of the window. If you've made any changes to the program since the last time you saved it, Script Editor gives you a chance to save the changes before closing the window.
Now open a new window by choosing File New. You get a new empty window. Inside that window, type the following text:
Display Dialog "Programming in AppleScript is fun."
Your window should look like the one shown in Figure 1-10.
Now, instead of clicking the Run button, click the Compile button. This has the effect of analyzing your program and reporting any errors to you without actually running your program. Notice that the colors and formatting ...
Get Beginning AppleScript® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.