AppleScript Tutorial Wiki
Display Dialog
Title Display Dialog
Dictionary Standard Additions
Suite User Interaction
Parameters 10

Display Dialog is a Command in the User Interaction Suite of the Standard Additions Dictionary. It is a command that displays certain user-defined parameters in a dialog box.


Following are a few examples to show what parameters the programmer can define to make different dialog boxes.


display dialog "Enter your text here..."

To the right is a picture of what this code will display on screen.

Simple dialog box ex1

An example of a simple dialog box.

By default, two buttons are added to the box. As you will see in a following example, these buttons may be customized.


display dialog "Enter your text here..." buttons {"Choice 1", "Choice 2"}

To the right is a picture of what this code will display on screen.

Custom buttons dialog box ex1

Custom buttons example.

Unfortunately, AppleScript only allows you to use three custom buttons. To overcome this problem, use AppleScript Studio.

Button Actions[]

type "if the button returned of the result is "Choice 1" then

(put your action here)"

then type "else" and then the action for the second button.


display dialog v : Display a dialog box, optionally requesting user input

display dialog text : the text to display in the dialog box
  • [default answer text] : the default editable text
  • [hidden answer boolean] : should editable text be displayed as bullets? (default is false)
  • [buttons list of text] : a list of up to three button names
  • [default button text or integer] : the name or number of the default button
  • [cancel button text or integer] : the name or number of the cancel button
  • [with title text] : the dialog window title
  • [with icon text or integer] : the resource name or ID of the icon to display…
  • [with icon stop/note/caution] : …or one of these system icons…
  • [with icon file] : …or an alias or file reference to a '.icns' file
  • [giving up after integer] : number of seconds to wait before automatically dismissing the dialog
→dialog reply : a record containing the button clicked and text entered (if any)
Sample for all things above:
 set my_name to "This is not my script, credits to maker."
 -- the window
 set DIALOG_1 to (display dialog "Enter password for " & return & "" & ¬
     quoted form of my_name ¬
     with title ¬
     "LiveJournal Post Event" with icon stop ¬
     default answer ¬
     "" buttons {"Continue…", "okay"} ¬
     default button 1 ¬
     giving up after 10 with hidden answer)
 set my_pass to text returned of DIALOG_1
 set button to button returned of DIALOG_1
 display dialog "hello, this is the pasword: " & my_pass
 display dialog "hello, you know that " & button & " is the button returned of the first window?"
 set optionList to {"one", "two", "three", "4", "jefeijs", "3;32.32", "I DON't want this"}
 set hey to choose from list optionList with prompt "This is not mine to:"
 set lol to hey
 if hey is false then
     error number -128 (* user cancelled *)
     set hey to hey's item 1 (* extract choice from list *)
 end if
 if lol is {"I DON't want this"} then
     display dialog "ok"
     display dialog "You choose: " & hey & " !"
 end if
 -- now try all things you want to do! goodluck, im not very good in English.

See Also[]

Display Alert