This is a side-track to another issue I’m having, developing in Obj-C and accessing Apple Mail’s information using AX (Accessibility) APIs.
In Monterey, I completely fail to access any e-mail message attachment. Even if I just created it in a new Message.
So… I wondered… and opened Script Debugger to see how I fare there.
In ‘explorer’ mode of the Dictionary window, I can dig through Accounts, Mailboxes and Messages, and identify messages that DO HAVE attachments. I can even see counts of attachments, However, the properties of an attachment (the class is “mail attachment”) seem to be always empty.
However – when I use Script debugger’s “paste tell” into a new AppleScript, for something I clearly see in explorer window – it ALWAYS fails, and no matter how hard I try to phrase my attempt to access – I fail, each time with weirder errors.
- Am I the only one to experience this? Did others see their old AppleScripts break with Monterey’s new ‘Mail’ application?
- How can Script Debugger’s explorer dig into hierarchies an AppleScript can’t?
Here are some of the things that failed.
-- "copy reference" and "paste tell" options yield the same script snippet: tell application "Mail" tell its account "ProofPoint Exchange" tell (get mailbox "Bugs") tell its message 1 tell its mail attachment "atl-generated-c38b2d51-f6f0-4a0c-8282-ff77945c1bd2.png" file size end tell end tell end tell end tell end tell
which fails with error: Mail got an error: Can’t get mailbox “Bugs” of account “ProofPoint Exchange”.
Event error: Error: no such object (e.g. specifier asked for the 3rd, but there are only 2) (errAENoSuchObject:-1728)
-- 'copy value' of 'file size' works, and yields 425. -- However, 'copy value' of the *whole attachment*, won't even compile! tell application "Mail" tell its account id "EAC63017-6E93-4701-B8A0-6BAAD7B8E478" tell its mailbox "Work Issues/Bugs" tell its message id 5 mail attachment id "1.2" end tell end tell end tell end tell
Any idea or hint will be greatly appreciated.