• 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: Is there any way to simplify this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there any way to simplify this?


  • Subject: Re: Is there any way to simplify this?
  • From: Nigel Garvey <email@hidden>
  • Date: Sat, 20 Jan 2001 12:42:55 +0000

Michelle Steiner wrote on Fri, 19 Jan 2001 14:26:28 -0800:

>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
>repition.
>
>--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

On the assumption that the only error encountered will be that
'thefilepath' is undefined (or that it's defined as something
incompatible with file paths):

set longAgo to (current date) - 14 * days
try
set thefilepath to thefilepath as alias
on error
set the thefilepath to choose folder
end try
tell application "Finder" to set thefilelist to every item ,
of thefilepath whose modification date is less than longAgo

NG


  • Prev by Date: Re: Applscript changes in 9.1 technotes
  • Next by Date: I want to compare two AppleWorks files
  • Previous by thread: Re: Is there any way to simplify this?
  • Next by thread: Re: Is there any way to simplify this?
  • Index(es):
    • Date
    • Thread