• 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: Halting a Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Halting a Script


  • Subject: Re: Halting a Script
  • From: Jon Pugh <email@hidden>
  • Date: Tue, 24 Jun 2003 19:06:31 -0700

At 12:47 AM +0100 6/25/03, John Delacour wrote:
>At 6:57 pm -0400 24/6/03, HomeLink USA wrote:
>
>> I'm looking for a way to halt a script or go to the end of the script. Can a script "quit" itself?
>
>if not 2 * 2 = 5 then
> return
>end if
>beep

Another popular trick, when you are nested three routines deep, is to throw the user canceled error.

error number -128

You can throw some other error if you want to catch it farther up the chain. Like so:

on bail()
error number 99
end bail

on crunch()
bail()
end crunch

on munch()
crunch()
end munch

on run
try
munch()
on error m number 99
display dialog "Yummy"
end try
end run

Wheee!

Jon
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Halting a Script (From: HomeLink USA <email@hidden>)
 >Re: Halting a Script (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Recipients in Mail.app
  • Next by Date: Re: Oh-oh, another victim to scripting Mail [SOLVED!]
  • Previous by thread: Re: Halting a Script
  • Next by thread: Re: Halting a Script
  • Index(es):
    • Date
    • Thread