Can "Cancel" button name be changed in "display dialog" box?

Hi,

Instead of OK and Cancel, I want to use Yes and No. To label the buttons, I know I can do something like the following:

set entBox to display dialog “Are you printing to the HP8000?” buttons {“Yes”, “No”} default button “Yes”

However, I don’t know what to do to make the “No” button the equivalent of a “Cancel” button. I’ve tried things like the following:

set ansBox to button returned of entBox
if ansBox = “No” then stop (or quit or whatever else I thought of last week)

Unfortunately, assuming I don’t get a syntax error, the script runs as if the user had clicked on the “Yes” button no matter what button was actually chosen.

Any ideas?

AppleScript: 1.9.3
Operating System: Mac OS X (10.3.9)

Hi, Rhayader.

set entBox to display dialog "Are you printing to the HP8000?" buttons {"Yes", "No"} default button "Yes"
if button returned of entBox is "No" then error number -128

Error number -128 is the “User canceled.” error that’s normally generated by the “Cancel” button (or its equivalent in other languages).

I’m not sure when this was added.

set entBox to display dialog "Are you printing to the HP8000?" buttons {"Yes", "No"} default button "Yes" cancel button "No"

Edit: This was added in AppleScript 1.10 (Mac OS X v10.4).