• 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: how to quit a script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: how to quit a script
      • From: Jim Schram <email@hidden>
References: 
 >Re: Stupid Question - how to quit a script (From: Michelle Steiner <email@hidden>)

  • Prev by Date: RE: Thanks for the follow up
  • Next by Date: Re: OSX URL Access Scripting
  • Previous by thread: Re: Stupid Question - how to quit a script
  • Next by thread: Re: how to quit a script
  • Index(es):
    • Date
    • Thread