17

Here are two Applescripts that can be used with geektool. One will desplay a customizable message on the desktop. The other will make the computer "read" the message using the vocal synthesizer.

Store the script anywhere and use as Shell the osascript command followed by the path to your script --> "osascript /Users/YOU/PATH/SCRIPT/ (note that Mail.app has to be launched)

Visual :

tell application "System Events"
    if exists process "Mail" then
        try
            tell application "Mail"
                set unreadCount to unread count of inbox
                if (unreadCount is equal to 1) then
                    set the_sender to get the sender of (messages of inbox whose read status is false) as string
                    set name_senders to extract name from the_sender
                    return "There is a new message from " & name_senders

                else

                    if (unreadCount is greater than 1) then
                        set the_sender to get the sender of (messages of inbox whose read status is false) as string
                        set name_senders to extract name from the_sender
                        return "There is " & (unreadCount as string) & " new messages"
                    end if
                end if
            end tell
        end try
    end if
end tell

Audio :

tell application "System Events"
    if exists process "Mail" then
        try
            tell application "Mail"
                set unreadCount to unread count of inbox
                if unreadCount is equal to 1 then
                    set the_sender to get the sender of (messages of inbox whose read status is false) as string
                    set name_senders to extract name from the_sender
                    say "you have a new mail from " & name_senders

                else

                    if unreadCount is greater than 1 then
                        say "you have " & unreadCount & " new mails "
                    end if
                end if
            end tell
        end try
    end if
end tell

Comments

Log in to comment or register here.