Re: "where its" vs "whose"
Re: "where its" vs "whose"
- Subject: Re: "where its" vs "whose"
- From: Axel Luttgens <email@hidden>
- Date: Mon, 29 Aug 2016 10:02:09 +0200
> Le 27 août 2016 à 16:52, Mitchell L Model a écrit :
>
> tell application "Safari"
> every window where its document is not missing value
> every window whose document is not missing value
> end tell
>
> I am getting the correct result for the first "every" and an error on the second.
> I believe i have always used "where its" and "whose" interchangeably.
> Or maybe not — I almost always use "whose" and used "where its" as part
> of a solution someone sent me for a different problem.
>
> What’s the difference and why?
Hello Mitchell,
Strictly speaking, keywords "where" and "whose" are synonyms; as a result, if an expression fails with one of these keywords, it should fail with the other as well.
And this is indeed the case:
tell application "Safari"
every window where document is not missing value
every window whose document is not missing value
end tell
But then, if making use of "its" solves the "problem" for one of these keywords, it should solve the problem with the other keyword too.
And yes, it "works":
tell application "Safari"
every window where its document is not missing value
every window whose its document is not missing value
end tell
Note that in the context of filter references, "whose" (or "where") and "its" (or "of it") have unrelated roles:
- the former allows to build the boolean expression to be satisfied
- the latter allows to make explicit the filter’s target
so that, for example, "where" and "where its" are not synonyms.
In the case of Safari, "document" is the name of a class, the name of an application’s elements and the name of a window’s property (all of these items having seemingly the same underlying code 'docu'):
tell application "Safari"
class of first document
documents
document of windows
end tell
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden