Re: Filters with "entire contents of"
Re: Filters with "entire contents of"
- Subject: Re: Filters with "entire contents of"
- From: Jan Cobb <email@hidden>
- Date: Sun, 17 Oct 2004 13:13:57 +0100
Title: Re: Filters with "entire contents of"
(Date/Time: 17/10/04 12:51 pm), Axel Luttgens wrote:
On 16/10/04 20:30, Michelle Steiner wrote:
Why don't the first three variations work? (using Script Editor 2.0, AS 1.9.3, Panther 10.3.5)
-- Michelle
set f to choose folder
tell application "Finder"
(entire contents of f) whose label index is not 0
end tell
--> "Can't get entire contents of alias
\"Dora:Users:michelle:Desktop:speech class:\" whose label index 0.
Access not allowed."
Changing the line to
get (entire contents of f) whose label index is not 0
--> "Can't get entire contents of alias
\"Dora:Users:michelle:Desktop:speech class:\" whose label index 0.
Access not allowed."
Changing it to
(get entire contents of f) whose label index is not 0
--> "Can't get {list of entire contents of the folder} whose label
index 0."
But changing it to the following yields the correct result:
(every item of entire contents of f) whose label index is not 0
You already got lots of replies.
So, if you allow, here follows an attempt to bring a sligthly different explaination...
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]
Just try with:
set f to choose folder
tell application "Finder"
f whose label index is not 0
end tell
--> "Can't get alias
\"Dora:Users:michelle:Desktop:speech class:\" whose label index 0.
Access not allowed."
The error mesage has exactly the same structure, tending to show that the "entire contents of" part was not the faulty one.
On the other hand, your last variation (the working one) has following syntax:
every item of <property> of <object> whose <boolean>
which reduces to:
every item of <anobject> whose <boolean>
Clearly, one has a filter reference form here.
Hmm...
Have a nice sunday anyway ;-)
Axel
[1] Semantically equivalent I mean.
Should one split the evaluation of the whole _expression_, either by using an intermediate variable or with the "get" keyword (as in your third variation), one would just end with <anobject> being an AppleScript list.
Thinking purely semantically, the reduction above, “every item of <anobject> whose <boolean>”, can be reduced still further – to “every item [of <anobject>] whose <boolean>”, which would explain why “every item” is required. Essentially, the “whose” acts on EACH of “every item”, before producing the result of a list; [of <anobject>] is arbitrary and doesn’t enter the equation (so’s to speak!).
Jan Cobb
_______________________________________________
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