Re: Applescript for 7 year Installation!
Re: Applescript for 7 year Installation!
- Subject: Re: Applescript for 7 year Installation!
- From: Roger Howard <email@hidden>
- Date: Tue, 14 Jun 2005 08:38:30 -0700
On Jun 14, 2005, at 5:24 AM, Christopher McClelland wrote:
Hi,
We are working on an installation that requires the loading of a file
at random times during a 6 am to midnight day, everyday, for the next
7 years! This 18 hour day is divided into 5 time zones where
different files are selected according to the time zone it is in.
We are using OS X's scheduling to turn on the computer every morning
at 6am and we have placed an applescript in the startup folder.
The applescript (see below) does the following:
1. Check the current time & decide what time zone it is in e.g. 3pm ->
C
2. Select a random file from that time zone (* the files are sorted
into folders representing time zones A, B, C, D, E)
3. load the file & the program needed to run it (in this case max/msp)
4. choose a random duration, and tell app how long to last
5. close the file & the program needed to run it
6. wait
7. Check the current time
.... continue loop until midnight, then shutdown computer.
(we are running G5 Dual 1.8 1Gb Ram OS X 10.3.8)
We have been carrying out tests with the system and it usually crashes
a few days in. The idea is that the computer will be unsupervised and
it is currently not stable enough for our project. Does anyone have
any advice/suggestions with the applescript or perhaps any other
solutions? We also have some problems with the random number
generator, it seems to favour some numbers rather than others!
Christopher,
7 years is a bit long to predict, but as long as you have standby
systems and a stable app I don't see a problem with a 7 year
installation...
That said, a few comments:
1 - I might not use AppleScript as the shell for this app - it's
totally clear to me what you're doing, but I might consider a shell
script (more portable) with only the pieces that you absolutely need
AppleScript for broken out into AS, executed with osascript perhaps.
Really though the entire thing could be done in a shell script if you
end up stuck on the crashing.
2 - If you keep the AppleScript, you need a rewrite - you're using a
repeat loop to implement a wait (until a condition is met)... this
could be the source of your crashes, and is at least not very efficient
(that repeat is going to run agressively as fast as possible). I'd use
an "idle" handler which runs less frequently (a 60 second delay?) and
tests for the time. This will keep the load down, making the script
much friendlier. Since it doesn't sound like you need much more
granularity than hourly, I'd think an idle handler would work much
better.
3. I'd also put in some method of logging script progress so you can
figure out if the crashing is isolated to a particular step.
4. The other option is to isolate the crashing code from a controller
script... if the crash happens, restart the applet from the controller
automatically.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden