Is there a simpler way to do this? I have the unreadCount and messageSubs returned to a growl notification.
tell application "Mail"
set unreadCount to 0
set messageSubs to ""
set allMessages to every message of inbox
repeat with aMessage in allMessages
if read status of aMessage is false then
set messageSubject to the subject of aMessage
set unreadCount to unreadCount + 1
if messageSubject's ((text items of messageSubject)'s item count) ≥ 20 then
set shortenedSub to ""
set itemCount to 0
repeat with aLetter in (text items of messageSubject)
set itemCount to itemCount + 1
if itemCount ≤ 20 then
set shortenedSub to shortenedSub & aLetter
end if
end repeat
set messageSubject to shortenedSub & "..."
end if
if not messageSubs = "" then
set messageSubs to messageSubs & ", "
end if
set messageSubs to messageSubs & messageSubject
end if
end repeat
end tell