OS X Mail: AppleScript's "set selected messages" selects the wrong message
| Originator: | robotspacer | ||
| Number: | rdar://24875277 | Date Originated: | 27-Feb-2016 02:33 PM |
| Status: | Open | Resolved: | |
| Product: | Product Version: | 10.11.3 | |
| Classification: | Other Bug | Reproducible: | Always |
Summary: I have a script that goes through all the messages in a mailbox and then uses some GUI scripting to perform some actions on them. I've discovered that script no longer works correctly—"set selected messages of message viewer 0 to aMessage" is selecting the wrong message. It always selects the message after the one I tell it to. Steps to Reproduce: 1. Open Mail. 2. Select a mailbox with at least two emails. 3. Open Script Editor. 4. Paste in this script: tell application "Mail" set theMailboxes to the selected mailboxes of message viewer 0 set aMailbox to item 1 of theMailboxes set theMessages to messages of aMailbox set aMessage to item 1 of theMessages set theSubject to subject of aMessage set selected messages of message viewer 0 to aMessage return theSubject end tell 5. Run the script. Expected Results: The script gets a reference to the first email in the selected mailbox. It then uses the same reference to get the subject of the email, and tells Mail to select that message. After the script is run, the selected message in Mail should match the subject text that Script Editor returns. Actual Results: Mail always selects the message that comes after the message it's told to select. Version: OS X 10.11.4 Beta (15E49a). Mail 9.3 (3124). Notes: I first noticed the bug in 10.11.3. Last year I had no problems with whatever version of Yosemite was current at the time. The latest 10.11.4 beta hasn't helped. Configuration: 4GHz i7, 32GB RAM, 1TB SSD, M295X Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!