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
http://lists.apple.com/archives/applescript-usersThis email
sent to
email@hidden
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
_______________________________________________
Do not post admin
requests to the list. They will be ignored.
AppleScript-Users mailing
list (
email@hidden)
Help/Unsubscribe/Update
http://lists.apple.com/archives/applescript-usersThis email
sent to
email@hidden
On Jun 04, 2014, at 04:11, S. J. Cunningham <email@hidden> wrote:
I'm developing a "Dead Man" system to periodically check for inactivity and sound an alarm in the event.
______________________________________________________________________
Hey Steve,
What kind of inactivity?
I am the sole caregiver for my wife is totally paralyzed with MS and I am worried that if I became incapacitated she could die of dehydration before someone found us. I am building a system to send out an escalating series of alarms if it hasn't detected me entering her room at least every two hours. I have a Foscam set up at the doorway which sends an email every time it detects motion. The email triggers a script which records the last activity time. A second script "daemon" checks the last activity file every two hours and sounds a local alarm if there has been no activity. If the alarm isn't retired within x minutes, it sends out text messages and emails to a prearranged list of responders.
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.
The Applescript option gives me more flexibility but I am leery of it's reliability. If the app dies, so may the person I am monitoring :(
If I wanted to use AppleScript in a very stable fashion I'd think carefully about using Smile (free for non-commercial use).
>From the way you phrased it, I'm not sure if you are recommending it or recommending against it :) I used to have Smile installed but it filled up the log with warnings from the system. I forget the details but it's mere presence triggered the messages and the developer said he had no plans to fix it. In any event I don't recall any functions it had which would increase stability. I used it mostly for it's string matching functions and the standard applescript string functions work fine for this application.
Steve Cunningham
_______________________________________________
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
I'm developing a "Dead
Man" system to periodically check for inactivity and sound an alarm in
the event. One option for the "daemon" is an AppleScript "stay-open"
application which uses an idle handler to periodically check for
inactivity. Another option is a script which is launched by cron (or
the Apple Launch Agent system) which checks for inactivity and then
quits.
The Applescript option gives me more flexibility but I am
leery of it's reliability. If the app dies, so may the person I am
monitoring :(
I would appreciate any experience other
users/developers may have with a similar situation. I am running Snow
Leopard.
P.S. I know there are other ways to do this but I am
familiar with Applescript and don't have the time to teach myself
Objective-C or some other language.
Thanks,
Steve
_______________________________________________
Do not post admin
requests to the list. They will be ignored.
AppleScript-Users mailing
list (
email@hidden)
Help/Unsubscribe/Update
http://lists.apple.com/archives/applescript-usersThis email
sent to
email@hidden