Re: "where its" vs "whose"
Re: "where its" vs "whose"
- Subject: Re: "where its" vs "whose"
- From: Deivy Petrescu <email@hidden>
- Date: Mon, 29 Aug 2016 12:11:24 -0400
> On Aug 29, 2016, at 04:02 , Axel Luttgens <email@hidden> wrote:
>
>
>> 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
>
Axel, nice explanation, however, check this in ScriptEditor log:
script:
-------------
tell application "Safari"
every window where its document ≠ missing value
end tell
------------
log:
------------
tell application "Safari"
get every window whose document ≠ missing value
--> {window id 1034}
end tell
Result:
{window id 1034 of application "Safari"}
—————
Note that the “where its” got translated to “whose” no its.
I do believe that this is a bug.
“whose" should accept a property, like document in this case, but it doesn’t.
The problem, as I see it, is that document is a property of window in the Standard suite not in the Safari suite.
May be there is some collision happening here and AS is not resolving it properly.
But this is a guess, for a full explanation I yield to Has….
Deivy Petrescu
email@hidden
_______________________________________________
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