Re: "where its" vs "whose"
Re: "where its" vs "whose"
- Subject: Re: "where its" vs "whose"
- From: Jim Underwood <email@hidden>
- Date: Mon, 29 Aug 2016 22:58:45 +0000
- Thread-topic: "where its" vs "whose"
This is a very interesting, yet confusing subject.
I just reread this:
Reference Forms from
the AppleScript Language Guide, which I found very helpful.
Here is one section very relevant to our discussion here:
Filter
Specifies
all objects in a container that match a condition, or test, specified by a Boolean _expression_.
The filter form specifies application objects only. It cannot be used to filter the AppleScript objects list , record ,
or text . A
term that uses the filter form is also known as a whose clause.
. . .
Within a test in a filter reference, the direct object is the object being tested.
Though it isn’t generally needed, this implicit target can be specified explicitly using the keyword it ,
which is described in The
it and me Keywords.
The following example shows several equivalent ways of constructing a filter reference to find all the files in a folder that whose name contains
the word “AppleScript”. While the term it refers
to the Finder application outside of the filter statements, within them of it refers
to the current file being tested. The result of each filter test is the same and is not changed by including or omitting the
term of it :
tell application "Finder"
|
it --result: application "Finder" (target of tell statement)
|
set myFolder to path to home folder
|
--result: alias "Leopard:Users:myUser:"
|
files in myFolder --result: a list of Finder document files
|
files in myFolder where name of it contains "AppleScript"
|
(* result: document file "AppleScriptLG.pdf" of folder "myUser"
|
of folder "Users" of startup disk of application "Finder"}*)
|
files in myFolder where name contains "AppleScript" -- same result
|
every file in myFolder whose name contains "AppleScript" -- same result
|
every file in myFolder where name of it contains "AppleScript"
|
-- same result
|
end tell
|
The key point for our discussion is:
The
result of each filter test is the same and is not changed by including or omitting the term of
it :
So, doesn't that mean that "whose <property>" and "whose its <property>" and "whose <property> of it" are all equivalent?
Jim Underwood
aka JMichaelTX
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden