Re: how to quit a script
Re: how to quit a script
- Subject: Re: how to quit a script
- From: Michael Turner <email@hidden>
- Date: Wed, 21 Nov 2001 09:58:32 -0400
Landis,
I should use Michelle's answer more often than I do. There is another way:
"return" can be used to interrupt a subroutine or the flow of the main
script. If used without a parameter, it will return the value of the
expression last evaluated. This is very useful for de-bugging. "return" is
also a constant, the 'end of line' character (\r).
Possibly this is a tangent: for 'stay open' scripts, there is a handler for
the 'quit' event.
on quit
display dialog "Really?" buttons {"Yes", "No"}
if button returned of the result is "Yes" then
continue quit
end if
end quit
A quit handler for a stay-open script without a 'continue quit' will result
in an 'unquitable' stay open script, requiring restart of the machine to
kill.
/Michael
>
On 11/19/01 11:49 AM, Landis <email@hidden> wrote:
>
>
> display dialog "Stop script and quit now?"
>
> if answer is yes then
>
> quit and stop running <-- this is the command I'm looking for
>
> end if
>
>
display dialog "Stop script and quit now?" buttons {"Yes", "No"}
>
if button returned of the result is "Yes" then
>
error number -128
>
else
>
display dialog "Still running"
>
end if
>
>
--Michelle