两个变量包含相同的AppleScript对象,但它们不相等,为什么?


1

我不明白:

tell application "Mail"
set A to first mailbox of first account
set B to every mailbox of first account
set C to first item of B

log C is A -- returns true, as expected

repeat with D in B
    log D is A -- returns false, WHY?!
    exit repeat
end repeat

end tell

我无法理解这些结果,特别是因为我得到了:

log D -- returns "mailbox INBOX of account id E7992E19-9A74-418D-BEBB-5F46C8A3E776"
log A -- returns "mailbox INBOX of account id E7992E19-9A74-418D-BEBB-5F46C8A3E776"
log class of A -- returns "container"
log class of D -- returns "container"

是什么让A不等于D?


1
在这种形式的repeat语句中,循环变量是对列表中项目的引用,而不是项目本身,因此D包含 {邮箱x的...的第1项,...的邮箱y,...} 不是 邮箱x .... 宾语。要使用引用获得良好结果,请使用 contents of,像这样 - > log (contents of D is A) -- returns true
jackjr300

@ jackjr300,你应该发表你的评论作为答案,以便可以进行投票,以增加你的声誉。
user3439894
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.