Re: Repeat-Dialog-Error
Re: Repeat-Dialog-Error
- Subject: Re: Repeat-Dialog-Error
- From: Richard 23 <email@hidden>
- Date: Wed, 28 Feb 2001 22:00:34 -0800
>
Why when I click the cancel button, do I get the
>
"Cancel failed" dialog.
"Cancel" is treated as a special case by display dialog which
generates an error number -128 when the "Cancel" button is
clicked by the user.
The same is not true of "choose from list", probably because it
wasn't originated by Apple, although it probably should have been
added for consistency.
Invariably I add this to scripts which use choose from list:
-- ---------------------------------------------------------
-- Preprocessed by Convert Script 1.0d4
-- ---------------------------------------------------------
-- author: Richard 23, date: Wednesday, February 28, 2001
-- ---------------------------------------------------------
repeat
choose from list {"foo", "bar"} with empty selection allowed
if result = false then
error number -128
else if result = {} then
exit repeat
else
display dialog "You chose " & result
end if
end repeat
display dialog "Goodbye, kind user!"
-- ---------------------------------------------------------
R23