1

I don't understand:

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

I cannot make sense of these results, especially since I'm getting:

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"

What makes A not equal to D?

  • 1
    In that form of repeat statement, loop variable is a reference to an item in a list and not the item itself, so D contains item 1 of {mailbox x of .., mailbox y of .., ...}, not the mailbox x of .... object. To get a good result with a reference, use contents of, like this --> log (contents of D is A) -- returns true – jackjr300 Feb 4 '17 at 17:48
  • @jackjr300, You should post your comment as an answer so it can be up-voted, so as to add to your reputation. – user3439894 Feb 4 '17 at 21:44

You must log in to answer this question.

Browse other questions tagged .