Rename "Cancel" button to another name in dialogue

I’ve seen this done in a dialogue box but I can’t remember how it was done. The “Cancel” button was renamed/remapped to “Not in List”. The “Not in List” button now has the same function that the default “Cancel” button does. Does anyone know how to do this?

Hi David, “Cancel” has a special meaning, but does this work?

display dialog "Hi" buttons {"OK", "I Give Up!"}
set x to the result
if x is "I Give Up!" then
	exit repeat
end if

The special meaning that Greg mentions is that the Cancel button generates a “User Canceled.” error, which stops the script from executing any further. If you want to change the name of the button but retain the effect, you have to generate the error explicitly.

set theResponse to button returned of (display dialog "Blah blah blah." buttons {"Not in list", "OK"} default button "OK")
if theResponse is "Not in list" then error number -128

beep -- just to demonstrate the script not continuing

The Cancel button in a ‘choose from list’ dialog always returns ‘false’, so you’d need to generate your own error here, whatever the button was called.

set theResponse to (choose from list {"red", "blue", "yellowish brown with a hint of persimmon"} with prompt "What's your favourite colour?" cancel button name "Not in list")
if theResponse is false then error number -128


To Nigel Garvey & Greg Spence,
Thanks for the replies and thanks to Mr. Garvey for explaining this in a way I can understand. Many cudos to both.