|
|
A very improved version
This version incorporates several improvements made by the above posters as well as an additional one: if there is new mail from several people, it will format it as a list and read it (e.g. for two emails, "You have mail from Bob and Joe," and for three, "You have email from Bob, Jane, and Joe.")
The other improvements are:
the iTunes fader works
it checks to see if iTunes is open before touching it (thus avoiding opening it if it's not open or playing a song if one isn't playing)
it doesn't activate the message
(I got rid of the log stuff because it is unnecessary)
using terms from application "Mail" on run tell application "Mail" to set sel to selection tell me to perform mail action with messages (sel) end run end using terms from using terms from application "Mail" on perform mail action with messages selectedMsgs set reactivate to false tell application "System Events" set the process_flag to (exists process "iTunes") end tell if the process_flag then tell application "iTunes" if player state is playing then repeat set snd to sound volume of application "iTunes" if snd is less than or equal to 30 then exit repeat end if set sound volume of application "iTunes" to (snd - 10) delay 0.1 end repeat set reactivate to true end if end tell end if set logString to "" & return set speakString to "You have mail from " tell application "Mail" set selCount to (count of selectedMsgs) repeat with counter from 1 to selCount set msg to item counter of selectedMsgs set theSender to sender of msg set theSender to extract name from theSender if length of theSender > 0 then if selCount > 1 and counter is selCount then set speakString to speakString & " and " end if set speakString to speakString & theSender if (selCount - counter) > 0 and selCount > 2 then set speakString to speakString & ", " end if end if end repeat set speakString to speakString & "." say speakString end tell if reactivate is true then tell application "iTunes" repeat set snd to sound volume of application "iTunes" if snd is greater than or equal to 100 then exit repeat end if set sound volume of application "iTunes" to (snd + 10) delay 0.1 end repeat end tell end if end perform mail action with messages end using terms from
A very improved version
this is a great script, i have a problem with it though. The volume for itunes gets maxed out everytime the script is run. How do I change so that it simplly goes back to the original volume state? If that's too much code, how about setting the volume to the middle?
A very improved version
okay so i got it set the volume to 50%, i got a little confused by the fader effect.
A very improved version
Okay, I figured it out :) I also changed the fader to fade in and out more gradually (+5, -5). It's seems like a smoother operation now. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|