Re: Quitting an Applet II
Re: Quitting an Applet II
- Subject: Re: Quitting an Applet II
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 04 Dec 2000 18:09:58 -0500
- Organization: [very little]
Carl West wrote:
>
Date: Mon, 04 Dec 2000 13:40:44 -0500
>
From: Carl West <email@hidden>
>
Organization: VPG Integrated Media
>
To: AppleScriptList <email@hidden>
>
Subject: Quitting an Applet II
>
>
Thanks for all the input on quitting a classic applet. I learned a lot.
>
>
Yesterday I wrote myself an alarm that on run pops up a dialog, I type
>
in a time, the time gets saved in a global and from then on, an 'on
>
idle' handler checks if that time is past and kicks off a repeat loop of
>
saying something and popping up a dialog with an "OK. I'm awake" button
>
giving up after 1.
>
>
The problem I have is one (or both) of these two things:
>
>
If I save it as a classic applet it quits as soon as I close the
>
type-in-the-time dialog. I don't know how to keep it open except with a
>
repeat loop instead of the 'on idle' handler.
>
>
If I save it as a stay-open applet I can't quit it from within (clicking
>
on the "OK. I'm awake" button) , I have to 'cmd-q'.
>
>
How do I either keep a classic applet open for a long time without
>
hogging the cpu, or close a stay-open applet from within?
You can't save it as a non-stay-open applet w/o hogging the CPU, unless
you want to use "pause", "delay", or the sleep osax in a repeat loop.
With the idle handler, you can set your return time by subtracting the
current time from the return time and using the result in a "return"
statement. That way, you don't have to keep checking if the return time
has come around. The script won't wake up until the return time.
As for quitting from the display dialog in the idle handler, all you
have to do is have a quit command followed by a return command. Without
the return command it won't quit until the end of the idle handler.
Marc [12/4/00 6:09:48 PM]