Re: Please explain this!? More....
Re: Please explain this!? More....
- Subject: Re: Please explain this!? More....
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 23 Nov 2001 08:02:17 -0800
On 11/23/01 5:07 AM, "Harald E Brandt" <email@hidden> wrote:
>
Quote from AppleScript Language Guide:
>
"The value of an Every Element reference is a list of the objects in the
>
container."
>
>
Now try:
>
tell application "Finder" to class of (every file in control panels folder)
>
-- {application file, control panel, control panel, control, control,
>
control, <and many more>}
>
>
The above violates AppleScript Language Guide!? It' not class list!
>
What are those braces?
>
The result of Every Element is thus not a list but a new, to me unknown,
>
class. (Set of classes?)
You're doing the same thing.
[property] of (every [element] in anything)
gets you the requested property for each item. The list that you're getting
there is the class of each file in the controls panel folder, one by one.
It's a fantastic feature, once you understand what it does. It does NOT
parse the sentence into separate bits. It does not actually behave like the
English language is supposed to, you are quite right. In spite of the claims
of AppleScript's adherents that it is "English-like", it's not actually
English, and that's what confusing you here. Again, you can get what you
want either by
tell application "Finder" to (every file in control panels folder)
class of result
-- list
or
tell application "Finder" to class of (get every file in control panels
folder)
using the explicit 'get' which makes the command treat what follows as a
result. That's what you thought you were asking for, but you weren't. Your
original command:
tell application "Finder" to class of (every file in control panels
folder)
can be understood as the real English
tell application "Finder" to get a list of the classes of each file in
control panels folder
Really - it's a fantastic feature, as you'll see once you start using it
yourself.
>
???
>
With semantics like this, I can't program!!
Actually, you just have to learn the semantics of this language, peculiar as
they may be ...
--
Paul Berkowitz