Re: Filters with "entire contents of"
Re: Filters with "entire contents of"
- Subject: Re: Filters with "entire contents of"
- From: Michael Terry <email@hidden>
- Date: Sun, 17 Oct 2004 10:33:12 -0700
On Oct 17, 2004, at 9:29 AM, Michelle Steiner wrote:
On Oct 17, 2004, at 4:51 AM, Axel Luttgens wrote:
I think the first three variations don't work because they just don't
contain any valid filter reference forms.
Let's consider the first one; it may be viewed as:
<property> of <object> whose <boolean>
In this case, the "<property> of <object>" part is "entire contents
of f", which yields another object (that may be viewed as some kind
of container - one that comes with every container); the end result
is thus equivalent to asking for:
<anobject> whose <boolean> [1]
If "entire contents of" returns a property, that's true. Here is an
interesting dichotomy:
tell application "Finder"
class of (entire contents of (choose folder))
class of foo
end tell
--> list of the classes of each item
tell application "Finder"
set foo to (entire contents of (choose folder))
class of foo
end tell
--> list
This doesn't disagree with what Axel (and I) said. Take the first case:
class of (entire contents of (choose folder))
The property asked for as the result of the property reference form is
'class'. It is important to understand that, when Finder analyzes this
part:
(entire contents of (choose folder)
... the result isn't a list yet, because that reference is part of a
larger reference:
class of (entire contents of (choose folder))
Finder obtains all the items that make up the 'entire contents', but it
still has to apply the 'class of' part. The whole reference hasn't been
evaluated yet. It's only after the 'class of' part is applied that the
reference has been fully parsed and evaluated, and is returned as a
list. A property reference CAN'T be applied to a list, but that is NOT
what '(entire contents of (choose folder))' is when it's just a middle
part of a larger reference.
When you write:
set foo to (entire contents of (choose folder))
... '(entire contents of (choose folder))' is the whole reference. It's
evaluated completely by Finder, and a list is returned, and then
assigned to 'foo'. (The assignment isn't part of the reference, and
isn't handled by Finder). When you write:
'class of (entire contents of (choose folder))'
... that is ALSO a whole reference, which is all evaluated by Finder.
The two examples you gave are completely different references, and that
makes all the difference.
Axel is right:
(entire contents of f) whose label index is not 0
... is just not a valid filter form. It's tempting to think that a
filter could be applied to 'entire contents' since, by itself, 'entire
contents of' returns a list of Finder items just like 'every item of'
does. But they're still different parts of AppleScript speech, and you
can only use filter clauses paired up with 'every item'.
Michael
_______________________________________________
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