I have this line in an AppleScript
set theResponse to display dialog "Name?" default answer myname with icon note buttons {"Cancel", "Continue"} default button "Continue"
If I click cancel the script continues. I want it to quit.
However, if I click cancel in this dialog:
display dialog "cancel"
the execution is interrupted.
try
, if
or similar clause.The Cancel
button is localized. It works if you use the name in your system language.
You can specify an explicit cancel button
in display dialog
which works in any localization
set theResponse to display dialog "Name?" default answer myname with icon note buttons {"Quit", "Continue"} cancel button "Quit" default button "Continue"
If you click Quit
the button behaves like the standard Cancel
button. It throws error -128 which is User cancelled