Basics of AppleScript

Dialog With Custom Buttons

Script [5.7.1]:

display dialog "Yo!!!" buttons {"Click Me"}

Explanation: Displays a dialog with text Yo!!! and button Click Me.

Figure 5.7.1

Figure 5.7.1 Custom Dialog Buttons

Figure 5.7.1-2

Figure 5.7.1-2 Result Tab Shows Button Returned

Script [5.7.2]:

display dialog "Yo!!!" buttons {"Click Me", "Don't Click Me", "Test Me"} default button 1

Explanation: Displays a dialog with text Yo!!! and buttons Click Me, Don’t Click Me and Test Me. We have also specified that the default button to be 1 that is Click Me and hence it will be highlighted.

Figure 5.7.2

Figure 5.7.2 Dialog with Custom Button and Default Button Set