On Jul 08, 2015, at 09:59, Patrick Stanford <
email@hidden> wrote:
The problem seems to be with Visible Messages.
______________________________________________________________________
Hey Pat,
Visible messages works fine on 10.9.5 at least (I hope a new bug has not been introduced in Yosemite).
---------------------------------------------------------------------------------------
# Test for MailHub Plug-In — adjust if necessary.
---------------------------------------------------------------------------------------
try
alias ((path to library folder from user domain as text) & "Mail:Bundles:MailHub.mailbundle:")
set offsetForMailHub to 1
on error
set offsetForMailHub to 0
end try
---------------------------------------------------------------------------------------
tell application "Mail"
set frontMsgVwr to some message viewer whose index is 1 + offsetForMailHub
tell frontMsgVwr
set visibleMessageCount to count of visible messages
end tell
end tell
---------------------------------------------------------------------------------------
* Note that if you have the MailHub Plug-In installed it will alter the indexing of Mail-Viewer Windows.
I actually don’t know what the visible messages is supposed to return, but it does not seem to work in any context. Is it supposed to give only the messages that can be seen in the message viewer or all of the messages that can be scrolled to?
On my 10.9.5 system it gives all messages currently available in the message list of the Message-Viewer-Window — including those NOT VISIBLE behind the Preview Pane.
It will also work with messages shown via Seach or via Smart-Mailbox, so it does have its uses.
Note that it is dangerous to refer to Message-Viewers in this way:
tell application "Mail"
front message viewer
first message viewer
message viewer 1
end tell
Because these will NOT refer to the FRONTMOST Message-Viewer if more than 1 Message-Viewer-Window is open.
Open two or more and point them to different mailboxes — then iterate through these to see it in action.
tell application "Mail"
name of front message viewer
name of first message viewer
name of message viewer 1
end tell
--
Best Regards,
Chris