Trying to set the system volume in a Mail Rule AppleScript
Trying to set the system volume in a Mail Rule AppleScript
- Subject: Trying to set the system volume in a Mail Rule AppleScript
- From: Christian Boyce via AppleScript-Users <email@hidden>
- Date: Sat, 22 Apr 2023 22:20:21 -0700
I have a Mail Rule that announces certain emails out loud. For example, if I
get an email from my Mom, the Mac will say “Mom sent you an email.”
I want to set the volume in the rule’s script.
I know how to set the volume— I can do it in a script like this:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set oldVolume to output volume of (get volume settings)
set volume output volume 10
delay 10
set volume output volume oldVolume
If I have System Preferences open, and showing the Sound settings, I can watch
the slider move and then move back after running this script. So I know how to
set the sound level.
But… in a Mail Rule that triggers an AppleScript, I find the “set volume output
volume 10” does nothing at all.
The script for a Mail Rule has to be something like this:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
set this_document to open for access
("/Users/cboycemacpro/Desktop/myspanishwords.html") with write permission
set the_content to read this_document
--display dialog the_content
repeat with eachMessage in theMessages
— do stuff here
end repeat
close access this_document
end perform mail action with messages
end using terms from
I put my sound-setting script step above “using terms from application “Mail””
and it has no effect. But that seems like the right place.
So now I am wondering, can we not do things like that in a Mail Rule?
Thanks for your help!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden