Re: Stay-Open Script Apps vs Cron
Re: Stay-Open Script Apps vs Cron
- Subject: Re: Stay-Open Script Apps vs Cron
- From: "S. J. Cunningham" <email@hidden>
- Date: Thu, 05 Jun 2014 07:45:04 -0400
On Jun 5, 2014, at 7:18 AM, Axel Luttgens wrote:
>
> Le 5 juin 2014 à 11:50, S. J. Cunningham a écrit :
>
>> [...]
>> I would prefer the daemon to run asynchronously, ie two hours from the last activity rather than simply every two hours. I thought I could do this by changing the idle time in an idle handler every time an email arrives but it looks like that is not possible.
>> [...]
>
> Hello Steve,
>
> Perhaps could you reverse the logics?
>
> The easiest, and probably the safest, would be to have the idle handler run, say, every 5 minutes.
>
> For example (with probably lots of details left as pseudo-code):
>
> on idle
>
> set last_activity to <fetch the last activity time from the last activity file as an AppleScript date>
>
> if current date - last_activity >= 2*hours then
> <sound a local alarm>
> end if
>
> return 5*minutes
>
> end idle
>
> HTH,
> Axel
Axel,
Thanks. I'll experiment with that as an option. I'm leaning toward cron rather than an idle loop because I have a vague suspicion that a "forever" idle loop is eventually going to misbehave. If I have to handle things synchronously anyway I suspect that cron will be more reliable. I'll probably experiment with both.
Steve
_______________________________________________
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