Re: Finder Duplicate Operation timing out
Re: Finder Duplicate Operation timing out
- Subject: Re: Finder Duplicate Operation timing out
- From: Kai Edwards <email@hidden>
- Date: Wed, 30 Jan 2002 22:50:13 +0100
>
Date: Wed, 30 Jan 2002 14:41:33 -0600
>
To: AppleScript <email@hidden>
>
From: Steve Kump <email@hidden>
>
Subject: Finder Duplicate Operation timing out
>
>
I have this code:
>
>
duplicate folder theFolder to folder "Macintosh HD:Backup:"
>
>
it works fine except it often times out with the message, Apple Event
>
Timed Out, because there are a lot of items in the folder to move,
>
and it takes a few minutes.
>
>
Is there a way to prevent this as it kills the rest of the script.
I believe the default timeout for an application command is 1 minute. This
means that AppleScript will normally wait 1 minute for a response from the
application (or scripting addition) addressed by the relevant command. If no
response is forthcoming, the script returns a timeout error.
To change the timeout period to, say, 5 minutes, try this:
with timeout of (5 * minutes) seconds
duplicate folder theFolder to folder "Macintosh HD:Backup:"
end timeout
Simply change the value 5 to the number of minutes you think the Finder will
need to comfortably accomplish the task in hand.
If you underestimate this time, you risk another timeout error. If you are
generous, the AppleScript will continue running the script as soon as the
application returns the result of the command. To demonstrate this, try:
tell application "Finder"
with timeout of (5 * minutes) seconds
beep
end timeout
beep
end tell
In spite of the timeout allowed for the first beep, the second beep should
follow directly after it. (Unless, of course, you have a lunatic beep that
takes longer than 5 minutes to play - in which case you'll get a timeout!)
BTW, the constant 'minutes' (which evaluates as 60) has been used to
simplify the measurement of time, which is expressed in seconds. So it
follows that:
minutes 60
hours 60 * minutes
days 24 * hours
weeks 7 * days
HTH
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************