Re: Stay-Open Script Apps vs Cron
Re: Stay-Open Script Apps vs Cron
- Subject: Re: Stay-Open Script Apps vs Cron
- From: Ted Wrigley <email@hidden>
- Date: Thu, 05 Jun 2014 10:33:04 -0700
On Jun 5, 2014, at 10:23 AM, S. J. Cunningham < email@hidden> wrote: On Jun 5, 2014, at 1:03 PM, Ted Wrigley wrote:
On Jun 5, 2014, at 4:40 AM, email@hidden wrote:
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.
Actually, that is possible - I’ve done it frequently. all you need to do, for instance, is return a number from the idle handler. for instance:
on idle return 7200 end idle
will call the script app in two hours (give or take ten seconds)
Yes, I know that. What I was looking for as a way to change the time before the two hours is up. There doesn't appear to be a way to do that.
Steve
Actually, there is. if a stay-open script in running, you can call one of its handlers directly from another script.
tell application "scriptname" someHandler() end tell
Once in that handler you can do whatever you like, including calling the idle handler to reset the clock. I suppose you could even call the idle handler directly, though I’ve never tried that myself. |
_______________________________________________
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