• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Applescript for 7 year Installation!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript for 7 year Installation!


  • Subject: Re: Applescript for 7 year Installation!
  • From: "Nigel Garvey" <email@hidden>
  • Date: Wed, 15 Jun 2005 02:31:55 +0100

Christopher McClelland wrote on Tue, 14 Jun 2005 13:24:54 +0100:

>We have been carrying out tests with the system and it usually crashes
>a few days in.

Besides a couple of optimisations that could reduce your seven-year
project to a few months... ;-) :

>set timeinsecs to (time of (current date))
>-- time in applescript is the no of seconds since midnight!
>set thehour to (round (timeinsecs / 3600) rounding down)

  set thehour to timeinsecs div hours

>repeat until thehour < 1 -- so after midnight stops repeat
>
>	if thehour 3 6 and thehour < 8 then
>		set fold to "A"
>	else if thehour 3 8 and thehour < 10 or thehour 3 12 and thehour < 14
>then
>		set fold to "B"
>	else if thehour 3 10 and thehour < 12 or thehour 3 16 and thehour < 19
>then
>		set fold to "C"
>	else if thehour 3 14 and thehour < 16 or thehour 3 19 and thehour < 21
>then
>		set fold to "D"
>	else if thehour 3 21 and thehour < 24 then
>		set fold to "E"
>	end if

  set fold to character thehour of "*****AABBCCAADDCCCDDEEE"

... etc., there are a couple of danger spots in your script:

>	tell application "Finder"
>		set fileList to every file of folder sourceFolder as alias list

Owing to a long-standing bug, the line above will crash if there's only
one file in the folder. The traditional workaround is:

  try
    set fileList to every file of folder sourceFolder as alias list
  on error
    set fileList to first file of folder sourceFolder as alias as list
  end try

>		set len to count fileList
>		if len > 1 then
>			set fileloc to (item (random number from 1 to len with seed (time of
>(current date))) of fileList)
>			open fileloc
>			delay 30
>			set dur to (read file "Macintosh HD:Applications:MaxMSP
>4.5:patches:rvh:dur.txt") -- Text File with duration in secs (Max/MSP
>needs this)
>			delay dur as integer -- delay the quitting of Max for the duration
>of the patch
>			quit application "MaxMSP 4.5"

It's usually been considered a bad idea to mention the word 'quit' inside
a Finder 'tell' block. (It's a bit like saying "walk" near a dog, or "tea
break" near a musician.) But you only need the Finder for the 'alias
list' stuff, so you could put the 'end tell' immediately after that.

My own experience of leaving machines to shut themselves down and start
themselves up while unattended is that something invariably goes wrong.
There's always some alert that needs manual acknowledgement before the
machine will continue. Seven years is pushing it a bit. Good luck.  :-)

NG

 _______________________________________________
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

  • Prev by Date: Re: OT: Re: it's all true
  • Next by Date: Scripting textedit the revenge
  • Previous by thread: Re: Applescript for 7 year Installation!
  • Next by thread: OT(-ish) Extracting something useful from an email
  • Index(es):
    • Date
    • Thread