Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

(I would request a clarification to the nice answer at Script that outputs number of emails in Mail.app inbox if I had the privileges to do so, but I'm new here)

I am finding that on Mavericks (OS X 10.9.1) using Mail v7.1 (1827), this script is not reporting the correct number of messages in the (IMAP) inbox. I am using the one-liner:

osascript -e 'tell application "Mail" to get the count of messages of mailbox "INBOX" of account "<ACCOUNT>"'

where <ACCOUNT> is my mail account name. This does report a number which is very close to the value reported in the titlebar of the Mail window. However, if I delete or refile a message from the inbox, the title bar value appropriately decrements, but the osascript-reported value does not. But I want all those fine-grained changes! I want to quantify all progress in clearing out my Inbox.

I've noted that the number of .emlx files in ~/Library/Mail/V2/IMAP-me@host/INBOX.mbox tends to agree with the value reported by the osascript command. This value also agrees with what is shown in the window produced by by control-clicking the Inbox and selecting "Get Account Info".

If I quit Mail and restart (and let it finish checking my other IMAP accounts), the osascript-reported value often changes, sometimes to the correct value, but usually still off (too big; not reflecting recent actions). If I rebuild the mailbox (very slow because of large attachments), the emlx count and the osascript-reported values diverge, and neither agrees with Mail's title bar.

So: in Mavericks is there ANY light-weight way (using osascript or otherwise) to access the latest updated mailbox count value show in the Mail title bar (or whatever the correct value is)?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.