Re: Forcing an applet to quit
Re: Forcing an applet to quit
- Subject: Re: Forcing an applet to quit
- From: Chris Nebel <email@hidden>
- Date: Tue, 09 Jan 2001 20:46:11 -0800
- Organization: Apple Computer, Inc.
Cal wrote:
>
"Marc K. Myers" <email@hidden> wrote:
>
>
> I tried this:
>
>
>
> on run
>
> beep
>
> doIt()
>
> beep
>
> end run
>
>
>
> on doIt()
>
> error -128
>
> end doIt
>
>
>
> as well as a bunch of other things in the handler that would make AS
>
> unhappy ("set a to 1 / 0"). In each case, the script beeped twice. I
>
> was surprised that it returned from the handler after the error. Is
>
> there a way to halt execution in the handler itself?
>
>
You forgot the word "number" in your "error" command:
>
>
error number -128
>
>
Without the word "number", you've basically told AppleScript to error with an
>
Error Message String of "-128", instead of the error numbered -128.
...which means that Script Editor will report the error, and it beeps when it
does so. The second beep is coming from the error dialog, not your script.
"error number -128" will terminate the script silently.
--Chris Nebel
AppleScript Engineering