Re: tell an applescript to abort
Re: tell an applescript to abort
- Subject: Re: tell an applescript to abort
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 25 Apr 2001 13:16:02 -0700
On 4/25/01 11:32 AM, "Jacob Roebuck" <email@hidden> wrote:
>
Hello,
>
>
How do you tell an applescript to stop running if a certain condition
>
happens?
>
In a top level of a script (i.e. the implicit run handler, or no handler)
return
In a handler that will just return you to the main script, so you need to
write:
error number -128
which is a "cancel" and will also work in a main script. Make sure that if
the whole thing is already in a try/on error block within the handler, you
trap for it:
try
--script
on error errMsg number errNum
if errNum is not -128 then -- if not a cancel
display dialog errMsg & return & return & errNum -- or whatever
else
error number -128 -- really quit this time
end if
end try
--
Paul Berkowitz