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: Thu, 31 Jan 2002 23:02:00 +0100
>
Date: Wed, 30 Jan 2002 23:02:51 -0800
>
To: AppleScript Users List <email@hidden>
>
From: Jon Pugh <email@hidden>
>
Subject: Re: Finder Duplicate Operation timing out
>
>
At 10:50 PM +0100 1/30/02, Kai Edwards wrote:
>
> 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.
>
>
I've found that you generally have only two states you want, the default "Stop
>
if it's taking too long" and the "Take as much time as it needs." Guessing a
>
time will invariably have you increasing it every time you find a folder that
>
takes longer.
>
>
So I always go long:
>
>
with timeout of 1000000 seconds -- 11.5 days
>
-- take your time
>
end
>
>
Now I'll never need to increase it.
Good point, Jon.
I guess what I said next:
>
> 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.
... sort of shuffled around this all-or-nuthin' wisdom, but didn't come
right out and say it - like wot you just done!
I agree we need to consider the worst-case scenario - as well as how we
might want a script to respond to it. So the criterion for a timeout value
probably has more to do with precisely how long we'd be prepared to wait for
a result or - thinking of when we might run such scripts - how long a break
we could take while the machine trundles through the required routines.
The idea of a straight choice between <almost-forever-if-necessary> and
<time-is-money-y'know!> seems to make more sense than a guestimate which
promises <this-may-get-done-in-time-but-then-again-it-might-just-break>.
While on the subject (but not wishing to appear too flippant about a very
sound piece of advice), I wondered if a conditional handler might be used
here? Perhaps something like:
on theUnderstanding(thatYou_mustHave_ThisResult)
if myScript_reallyNeeds_1000000seconds then
tell me to book_that_break(Bahamas)
else if myScript_might_finish_inAnywhereNear_30000seconds then
display dialog "G'night - see you in the morning." buttons {"Yawn", "ZZZ"}
else
try
getOnWithIt("andMakeItSnappy", "Bub!")
on error
set alarmClock to crack_O_dawn
end try
end if
return only_in_emergency
end theUnderstanding
(Um - BTW, how come this compiles but won't run?) ;)
Seriously though, Jon - thanks for clarifying the issue. (And, if I might
briefly digress, thanks also for Jon's Commands - which has saved my skin on
many occasions!)
Best wishes.
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************