• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trying to set the system volume in a Mail Rule AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Trying to set the system volume in a Mail Rule AppleScript
      • From: Laine via AppleScript-Users <email@hidden>
    • Re: Trying to set the system volume in a Mail Rule AppleScript
      • From: Steve Mills via AppleScript-Users <email@hidden>
    • Re: Trying to set the system volume in a Mail Rule AppleScript
      • From: Laine via AppleScript-Users <email@hidden>
  • Prev by Date: Re: Script Editor Fails to save Description Field
  • Next by Date: Re: Trying to set the system volume in a Mail Rule AppleScript
  • Previous by thread: Script Editor Fails to save Description Field
  • Next by thread: Re: Trying to set the system volume in a Mail Rule AppleScript
  • Index(es):
    • Date
    • Thread