Re: Any Way to Force an Idle Handler System Call?
Re: Any Way to Force an Idle Handler System Call?
- Subject: Re: Any Way to Force an Idle Handler System Call?
- From: Christopher Nebel <email@hidden>
- Date: Wed, 04 Jun 2014 16:09:27 -0700
On Jun 4, 2014, at 1:52 PM, S. J. Cunningham <email@hidden> wrote:
> On Jun 4, 2014, at 4:03 PM, S. J. Cunningham wrote:
>
>> I have a stay-open application with an idle handler set to be called every "x" seconds. I would like to be able to change the period to another value before the current period ends. I can call the idle hander from another script but it doesn't reset the system's next call.
>
> Bill Cheesman says you can do this:
>
> "An alternative technique is to set the idle interval to a very long time -- effectively forever -- as soon as idle handling is to be paused. Then the idle handler will not even be called by the system until other code -- perhaps an external AppleScript application -- explicitly calls the idle handler again, at which time the idle interval can be reset to a shorter time to "unpause" it." (http://macscripter.net/viewtopic.php?id=24568)
>
> When I try this the new idle interval is returned to the calling script, not to the system. The system still follows the original "forever" setting.
>
> Maybe I'm missing something.
You’re not; this is an unusual slip by Bill. The applet shell only pays attention to the result of the idle handler when it calls it itself, not when your script calls it. There’s also no way to alter the interval except by returning a result from the idle handler. You could fake it by deliberately using a short time, and then decide in the idle handler whether or not to do anything.
—Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden