Re: Is there any way to simplify this?
Re: Is there any way to simplify this?
- Subject: Re: Is there any way to simplify this?
- From: Shane Stanley <email@hidden>
- Date: Sat, 20 Jan 2001 17:43:45 +1100
On 20/1/01 9:26 AM +1000, Michelle Steiner, email@hidden, wrote:
>
Can this script fragment be simplified? It bothers me that I had to type
>
the tell statement twice, and wonder if there's a way to avoid the
>
repetition.
>
>
--Michelle
>
>
set longAgo to (current date) - 14 * days
>
try
>
tell application "Finder" to set thefilelist to every item ,
>
of thefilepath whose modification date is less than longAgo
>
on error
>
set the thefilepath to choose folder
>
tell application "Finder" to set thefilelist to every item ,
>
of thefilepath whose modification date is less than longAgo
>
end try
Assuming you don't want the choose folder dialog to appear in the Finder,
you could use this:
set longAgo to (current date) - 14 * days
repeat
try
tell application "Finder" to set thefilelist to every item of thefilepath
whose modification date is less than longAgo
exit repeat
on error
set the thefilepath to choose folder
end try
end repeat
--
Shane Stanley, email@hidden