• 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: whose clause with two conditions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: whose clause with two conditions?


  • Subject: Re: whose clause with two conditions?
  • From: Axel Luttgens <email@hidden>
  • Date: Thu, 25 May 2006 15:44:08 +0200

On 25/05/06 15:10, Ruth Bygrave wrote:
Something I quite often want to do. I can never seem to get something like ('photographs whose date is last month and whose keyword is cats') or ('music files beginning with 'Night' or 'The Night') or ('backup all files whose extension is 'xml' except this one')

This doesn't work. Is there a good simple way round this sort of thing?

get (files of folder docfolder whose name extension is "txt") and (files of folder docfolder whose name extension is "xml")

As you are using "files" and "folder", which are items known by the Finder, I suppose you have enclosed above statement within a tell block targeted to the Finder.
On the other hand, as you are filtering the contents of a single folder, you may just write:

    tell application "Finder"
        get files of folder docfolder whose name extension is "txt" or name extension is "xml"
    end

The general form is:

    <_expression_> whose <filter _expression_>

In you case, <_expression_> is "files of folder docfolder", which returns a list with every files contained in the folder.
You then just want the Finder to filter that list according to some criteria, provided by the <filter _expression_>.
Note that the latter must be a logical _expression_ that may be applied to each of the list's items.

Now, you could also decide to filter twice and to merge the resulting lists:

    tell application "Finder"
        get (files of folder docfolder whose name extension is "txt") & (
files of folder docfolder whose name extension is "xml")
    end

Should provide the same result, but in a slightly less efficient way.

HTH,
Axel
 _______________________________________________
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

References: 
 >whose clause with two conditions? (From: Ruth Bygrave <email@hidden>)

  • Prev by Date: Suppress dialog box
  • Next by Date: Re: terminal does not react
  • Previous by thread: whose clause with two conditions?
  • Next by thread: Re: whose clause with two conditions?
  • Index(es):
    • Date
    • Thread