• 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
Re: Trying to set the system volume in a Mail Rule AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to set the system volume in a Mail Rule AppleScript


  • Subject: Re: Trying to set the system volume in a Mail Rule AppleScript
  • From: Laine via AppleScript-Users <email@hidden>
  • Date: Sun, 23 Apr 2023 01:48:31 -0500


> On Apr 23, 2023, at 12:20 AM, Christian Boyce via AppleScript-Users
> <email@hidden> wrote:
>
> 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!
>
> This email sent to email@hidden



Try bouncing that rascal right back at Script Editor:


-- do stuff here
                        using terms from application "Script Editor"
                                set volume output volume [your value]
                        end using terms from


Best regards,
L. Lee

 _______________________________________________
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

References: 
 >Trying to set the system volume in a Mail Rule AppleScript (From: Christian Boyce via AppleScript-Users <email@hidden>)

  • Prev by Date: Trying to set the system volume in a Mail Rule AppleScript
  • Next by Date: Re: Trying to set the system volume in a Mail Rule AppleScript
  • Previous by thread: Trying to set the system volume in a Mail Rule AppleScript
  • Next by thread: Re: Trying to set the system volume in a Mail Rule AppleScript
  • Index(es):
    • Date
    • Thread