Re: Is it possible to set up an 'instant' idle handler
Re: Is it possible to set up an 'instant' idle handler
- Subject: Re: Is it possible to set up an 'instant' idle handler
- From: Kai Edwards <email@hidden>
- Date: Mon, 07 Oct 2002 10:36:16 +0000
on Sun, 06 Oct 2002 16:13:46 -0700, Paul Berkowitz <email@hidden>
wrote:
>
On 10/6/02 3:00 PM, "Sven Ryen" <email@hidden> wrote:
>
>
> Hi!
>
>
>
> I read in the documentation that the idle handler had to return an integer
>
> in order to schedule it to be re-run. Is it possible to make it run
>
> 'instantly', rather than wait for a second?
>
>
>
Hi, Sven
>
>
Just tell the script to
>
>
idle
>
>
as the first and only command of the main script. Then put everything else
>
into the idle handler.
When everything is in the idle subroutine, the idle command doesn't appear
to be necessary.
The delay kicks in only after the handler's first run (when the required
idle time has been specified). In fact, it's when you *don't* want the idle
handler to jump straight in that some extra work seems to be needed:
--------------------
global firstRun
set firstRun to true
on idle
if firstRun then
set firstRun to false
else
-- do stuff
end if
return 60 -- or whatever
end idle
--------------------
(I usually try to avoid suggesting something that does the exact opposite of
what's been asked but - hey, while we're on the subject!) ;-)
Kai
--
email@hidden
email@hidden
_______________________________________________
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.