Mail.app inbox total Simple Question

Is there a way to get the total number of emails in your inbox from Mail.app via applescript?
I would like a program that will use that variable and report back to me at certain intervals how many unread mails I have left. I can trigger the applescript to run every 30 minutes or so using iCal but can’t seem to figure out how to pull that info from Mail. Any suggestions?

Hi Corbin,

You could try something along the lines of:

tell application "Mail"
	set myCountArray to unread count of (mailbox "INBOX" of (every account whose enabled is true))
	set myCount to 0
	repeat with myCountItem in myCountArray
		set myCount to myCount + myCountItem
	end repeat
end tell
display dialog "Unread count is: " & myCount

Best wishes

John M

Excellent, works great. Thanks!