• 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: Quitting from an idle handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quitting from an idle handler


  • Subject: Re: Quitting from an idle handler
  • From: "J. Stewart" <email@hidden>
  • Date: Mon, 8 Aug 2005 08:02:03 -0400

On 08/07/05 at -0700 Gil Dawson said this

>Consider the following saved as a stay-open application:
>
>FatalError("Please stop.")
>
>on FatalError(msg)
>   display dialog "Fatal Error:" & msg buttons "OK" with icon stop
>   tell me to quit
>   error "He didn't quit. "
>end FatalError
>
>I am using Smile 2.6.9 and MacOS 10.4.2.  When launched on my machine
>by double-clicking its icon, this little script displays the "Fatal
>error: "Please stop." dialog, then another dialog with "He didn't
>quit".  After that it does nothing, but remains an active process
>with an icon in my dock.
>
>I don't want it to remain an active process.  I want it to quit.
>
>How can I get it to quit?


This works in this particular instance OMM.

FatalError("Please stop.")

on FatalError(msg)
    display dialog "Fatal Error:" & msg buttons "OK" with icon stop
    error number -128
    error "He didn't quit. "
end FatalError

The "error number -128" line produces a user cancelled error which causes this script to exit. It may work in your script.

I must admit to being a bit curious as to why you would want/need to write a custom error handler when there is a built in construct that will usually do a better job of it. Try - on error's sole purpose is to deal with errors. It can notify, ignore, supply alternative methods and of course, bail out.

JBS
--
42.7 percent of all statistics are made up on the spot.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Quitting from an idle handler
      • From: Gil Dawson <email@hidden>
References: 
 >Re: Quitting from an idle handler (From: Gil Dawson <email@hidden>)

  • Prev by Date: Re: Quitting from an idle handle
  • Next by Date: Mail script broken by Tiger
  • Previous by thread: Re: Quitting from an idle handler
  • Next by thread: Re: Quitting from an idle handler
  • Index(es):
    • Date
    • Thread