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

Quit Command from a Script Menu


  • Subject: Quit Command from a Script Menu
  • From: <email@hidden>
  • Date: 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.

I realize I could have the handlers return pass/fail values and bypass
the following ones with a test, but that get's really tedious with a
large number of handlers.

My objective is write a script that will catch fatal errors such as
timeouts, etc. and gracefully terminate, closing open files, updating
stored variables, etc.

Any suggestions for how to accomplish this?

Steve

----- Attached Script ---------


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

on handler_2()
display dialog "Executing Handler 2"
return
end handler_2

on handler_3()
display dialog "Executing Handler 3"
return
end handler_3

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

-->>Main Script<<

handler_1()
handler_2()
handler_3()
_______________________________________________
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: Re: Icon on Alert window
  • Next by Date: Coerce a returned list of objects into a string
  • Previous by thread: Re: Help needed with Now Contact script
  • Next by thread: Re: Quit Command from a Script Menu
  • Index(es):
    • Date
    • Thread