• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Repeat-Dialog-Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repeat-Dialog-Error


  • Subject: Re: Repeat-Dialog-Error
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 28 Feb 2001 23:30:19 -0800

On 2/28/01 10:23 PM, "Daniel Shockley" <email@hidden> wrote:

> Paul made some good points about how the "Cancel" button genereating an actual
> error is a good
> thing. Nevertheless, if you want a Cancel button that just acts like a regular
> old button, name it
> " Cancel " Notice the spaces on each end of the name? AppleScript generates
> the "User Cancelled
> error when a button named "Cancel" is clicked and released, but " Cancel " is
> just another button
> with a text name.

That is especially useful on an English-language system when you need to do
something, like restore some property to how it started out (as the user
would expect when he cancels) _before_ the real cancel:

property theBeeps : 0

display dialog "How many beeps would you like to hear every time this
script finishes running?" buttons {"0", "1", "100"} with icon 1
set theBeeps to (button returned of result) as integer
display dialog "" & theBeeps & " beeps? Are you sure about that?"
buttons {" Cancel ", " Yes! "} with icon 2
if button returned of result = " Cancel " then
set theBeeps to 0 -- YOU'D BETTER DO THIS
error number -128 -- now you can cancel
end if
-- do stuff
beep theBeeps -- or else you're going to get 100 beeps



--
Paul Berkowitz


References: 
 >Re: Repeat-Dialog-Error (From: Daniel Shockley <email@hidden>)

  • Prev by Date: Re: Text without formatting (OS 9.1)
  • Next by Date: Re: I want to convert a list of integers to their negative self
  • Previous by thread: Re: Repeat-Dialog-Error
  • Next by thread: Re: applescript-users digest, Vol 2 #438 - 15 msgs
  • Index(es):
    • Date
    • Thread