4

This Geeklet Shows All (Unlike previous Mail Geeklet) Unread/Read emails in the Inbox. Unread emails are marked with a bullet.

Applescript - save wherever you like

tell application "Mail"
    set theOutput to ""
    repeat with msg in messages in inbox
        if msg's read status is not true then
            set theOutput to theOutput & "• "
        else
            set theOutput to theOutput & "   "
        end if
        set theSender to extract name from sender of msg
        set theSubject to subject of msg
        set theOutput to theOutput & theSender & " – " & theSubject & (ASCII character 10)
    end repeat
    theOutput
end tell

Then, add a Shell Geeklet pointed towards the Applescript location, like...

osascript ~/Documents/Applescript/Mail.scpt

Comments

User Avatar
MaxMan 2957 days ago
Hey, nice idea.. but it doesn't work for me.

It opens up Mail but it doesn't display anything.

Any ideas how it could work?
User Avatar
bearbo 2956 days ago
I'm guessing it is because that the script is scanning through literally **ALL** of your emails. If you are anything like me, having more than a few hundreds emails in the Inbox, the script will take a long time to run.
User Avatar
atibor 2956 days ago
Hi, I have 2 accounts in Mail, but although the script gets data from inbox, it gets mails only from the inbox of the first account.

Any idea to read list from the common inbox? Thanx in advance.
User Avatar
bearbo 2956 days ago
I think from the AppleScript's perspective, the "common" inbox index is sorted first by account, then by date. So it will show all of emails from one account by date, *then* the emails from the 2nd account.
User Avatar
MaxMan 2956 days ago
The script is now running ~10 min but nothing happens.

I just copied it and pasted it to apple script editor..

EDIT: After about 20-30 min the script finished running...
User Avatar
cycle4passion 2951 days ago
With further use I have seen that after emails have been cleared from the inbox, they are not cleared from the list of inbox contents. Updated script only shows unread emails.

-- #!/usr/bin/osascript

tell application "Mail"

set theOutput to ""

repeat with msg in messages in inbox

if msg's read status is not true then

set theSender to extract name from sender of msg

set theSubject to subject of msg

set theOutput to "• " & theOutput & theSender & " – " & theSubject & (ASCII character 10)

end if

end repeat

theOutput

end tell

end
User Avatar
cycle4passion 2643 days ago
quit working, another update

set newline to ASCII character 10

set finalText to ""

tell application "Mail"

set theMessages to (messages of inbox whose read status is false)

repeat with i from 1 to number of items in theMessages

set thisMessage to item i of theMessages



set fromMsg to (extract name from sender of thisMessage as string)

set subjMsg to (subject of thisMessage as string)

set finalText to finalText & "• " & fromMsg & " - " & subjMsg & newline



end repeat

end tell

finalText

Log in to comment or register here.