Re: Re: Passing variables between scripts (+quit handlers)
Re: Re: Passing variables between scripts (+quit handlers)
- Subject: Re: Re: Passing variables between scripts (+quit handlers)
- From: Richard 23 <email@hidden>
- Date: Tue, 12 Dec 2000 16:49:52 -0800
>
And if you have made the helper a stay-open application, as Scott suggested,
>
then you'll have to add another handler to it:
>
>
on quit
>
continue quit
>
end quit
>
>
or it won't actually quit. Or such has been my limited experience with
>
stay-opens. Is there another way?
you don't need a quit handler unless you need to perform some clean-up
before quitting. It will quit fine without it (at least in my experience
thus far...) I've also found (and I doubt this is intentional) that
certain property values can actually prevent the script from saving
the state of its properties when it closes. The only one that comes to
mind is the value assigned to Prop_Test in this stay-open test applet:
--------------------
property Prop_Test: ""
on run
tell application "Finder" to set Prop_Test to a reference to ==>
(processes where frontmost = true)
end run
on idle
beep -- annoy the user
return 2
end idle
-- clean-up by clearing naughty value in Prop_Test so quit is nice
on quit
try
set Prop_Test to ""
on error errTxt number errNum
activate me
display dialog "Error " & errNum & ": " & errTxt
end try
continue quit
end
--------------------
Note: You don't need to have a quit handler most of the time.
This script has one to perform clean-up (clearing a property) only
because at least on my system, leaving Prop_Test set to the reference
causes an error -1750 and prevents the script from saving it
properties
when it quits.
IMPORTANT!
If you ever do use a quit handler be very sure, no matter how simple the
code may seem, to wrap it in an error handler so the script will not be
prevented from executing the continue quit. There's nothing quite as fun
as an applet that won't quit. If you get stuck in this position, be sure
to save everything you value in unsaved windows of other applications
before trying the ctrl-opt-cmd-esc keys to kill it. I've had applets crash
and burn on force-quit and MacsBug was unable to get back to the Finder.
Use wisely!
R23