Title: Re: Using various notification sounds
This from Christian Valentine - dated 20/6/02 09.28 pm:

> Is the script that reads message information available somewhere?

Hi, Christian.

The script I use is a stay open applet that gets run as part of my ‘send & receive all’ schedule (a script tells it to run, and another that runs when Entourage shuts down quits it).

Here it is in all its gnarly uncommented glory. Obviously, as it stands, its very specific to my particular mail folder arrangements, but hopefully you can glean some useful stuff from it.

on run
   set theWords to ""
    
delay
30
   
set activeApp to path to frontmost application
   set theName to name of (info for activeApp)
    
if theName is not "
Microsoft Entourage" then my AnnounceMail(theWords)
end run

on AnnounceMail(theWords)
    
tell application "
Microsoft Entourage"
        
set mCount to 0
       
set LmCount to 0
       
set mBoxes to every folder whose ID = 1 or ID > 5
       
repeat with mBox in mBoxes
           set mCount to mCount + (unread message count of mBox)
        
end repeat
       repeat with
thefolder in folders of folder "
Lists"
            
set LmCount to LmCount + (unread message count of thefolder)
        
end repeat
       set
mTotal to mCount + LmCount
       if mTotal >
0 then
           if
mTotal = LmCount then
               if
LmCount >
1 then
                   set
theWords to "
You have " & mTotal & " [[emph ++]]list messages."
                
else
                   set
theWords to "
One [[slnc 50]]new [[emph ++]]list message."
                
end if
           else if
mTotal > LmCount and LmCount >
0 then
               if
LmCount >
1 then
                   set
theWords to "
You now have " & mTotal & ¬
                        "
new emails, including " & LmCount & " [[emph ++]]list messages."
                
else
                   set
theWords to "
There are " & mTotal & ¬
                        "
emails waiting to be red, including one list message."
                
end if
           else if
LmCount =
0 then
               if
mTotal >
1 then
                   set
theWords to "
There are " & mTotal & " [[slnc 50]]emails waiting to be opened."
                
else
                   set
theWords to "
You have just one [[slnc 50]] new message."
                
end if
           end if
           set
tBox to folder "
Mr Tea's Inbox"
            
set tMail to (messages whose read status is untouched) of tBox
           set tCount to count of items in tMail
           set mCount to
0
           
if tCount > 0 then
               set
mSenders to ""
                
repeat with
tMessage in tMail
                   set theFullAddr to sender of tMessage
                   set mSender to display name of theFullAddr as string
                   if mSender is "" then
                       set
mAddr to address of theFullAddr
                       set mSender to text
1 thru ((offset of "@" in mAddr) - 1) of mAddr
                   end if
                   set
mCount to mCount +
1
                   
if mCount < tCount then
                       set
mSenders to mSenders & mSender & "
, "
                    
else if tCount > 1 then
                       set
mSenders to mSenders & "
and " & mSender & "."
                    
else
                       set
mSenders to mSender & "
."
                    
end if
               end repeat
               set
theWords to theWords & ¬
                    "
Mister [[emph ++]]Tea has mail from " & mSenders
           end if
       end if
   end tell
   if
mTotal >
0 then
       set
theChimeFolder to "
Studio!:Studio Files:Resources:Sounds:Mail Chimes:"
        
set theChimes to list folder alias theChimeFolder without invisibles
       set theChime to (theChimeFolder & (some item of theChimes)) as alias
       tell application "
Play Sound" to play sound theChime
       set theVoice to some item of {"
Fred", "Junior", "Princess", "Ralph", "Trinoids", "Zarvox"}
        
repeat
           try
               
say theWords using theVoice
               exit repeat
           end try
           
delay
1
       
end repeat
   end if
end
AnnounceMail

I’ve also posted the script on my iDisk, along with some delightful sound effects. You can find these at http://homepage.mac.com/mrtea/.

Regards

Mr Tea
--
 "Always remember to warm the pot."

Reply via email to