• 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: Quit Command from a Script Menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quit Command from a Script Menu


  • Subject: Re: Quit Command from a Script Menu
  • From: Nigel Garvey <email@hidden>
  • Date: Tue, 6 Jul 2004 01:05:54 +0100

<email@hidden> wrote on Sun, 4 Jul 2004 17:12:54 -0400:

>I have the attached script that I would like to run from an application's
>Script Menu (in this case, Claris Emailer). What I am trying to do is
>skip execution of handlers 2 and 3 if an error occurrs in handler 1. It
>works fine when running as a stand alone script, but when I try to run it
>from a script menu, the application gets the quit message instead of the
>script... and, after the application quits, handlers 2 and 3 run.

>on handler_1()
> display dialog "Executing Handler 1"
> abort()
> return
>end handler_1

>on abort()
> display dialog "Quitting"
> -- If run standalone, handlers 2 & 3 won't be executed.
> -- However, either quit form below results in Emailer quitting and the
>script
> -- continuing to run when run from the Emailer Script Menu
> quit
> tell me to quit
>end abort

The 'quit' command is for quitting applications. Both your 'quit' lines
are directed at the application running the script - which is the applet
itself when the script's run as a stand-alone application, and Emailer
when it's run from Emailer's script menu. The application concerned duly
quits, but only when it's finished running the script. I'd expect
handlers 2 and 3 to be executed in any case, even in a "stand alone"
situation.

To stop a script from executing any further, you can used the "User
canceled" error:

on abort()
display dialog "Quitting"

-- Do any tidying up here

error number -128 -- stop immediately, here
end abort

NG
_______________________________________________
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.


  • Prev by Date: URLs, RFCs, wrapping, code, posting, etc. (was Re: Sorry)
  • Next by Date: Re: Quit Command from a Script Menu
  • Previous by thread: Quit Command from a Script Menu
  • Next by thread: Re: Quit Command from a Script Menu
  • Index(es):
    • Date
    • Thread