• 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: tell an applescript to abort
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >tell an applescript to abort (From: Jacob Roebuck <email@hidden>)

  • Prev by Date: Re: tell an applescript to abort
  • Next by Date: [OT] Better list response [WAS: Re: error -48 duplicate name postscripting from xpress 4.1]
  • Previous by thread: Re: tell an applescript to abort
  • Next by thread: Re: tell an applescript to abort
  • Index(es):
    • Date
    • Thread