• 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: My AppleScript to choose sound output has broken in Monterey
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My AppleScript to choose sound output has broken in Monterey


  • Subject: Re: My AppleScript to choose sound output has broken in Monterey
  • From: Jim Krenz via AppleScript-Users <email@hidden>
  • Date: Sat, 6 Nov 2021 13:20:27 -0700

Hi Laine,

I appreciate your answer, as I have used a similar script in the past. I moved
away from it, as I don’t like opening System Preferences and quitting it.

I do like opening the Sound menu, with the selected checkbox left showing as
the active selection.

Does anyone have any suggestions on how to fix my script?

Jim

> On Nov 5, 2021, at 7:47pm, email@hidden wrote:
>
>
>> On Nov 5, 2021, at 8:13 PM, Jim Krenz via AppleScript-Users
>> <email@hidden
>> <mailto:email@hidden>> wrote:
>>
>> Hello all,
>>
>> This script was working in Big Sur.
>>
>> I am trying the trial of UI Browser to try to figure this out, but I am
>> failing.
>>
>> Troubleshooting ideas on how to fix this?
>>
>> tell application "System Events"
>>      tell process "ControlCenter"
>>              try
>>                      click (first menu bar item whose title is "Sound") of
>> menu bar 1
>>                      tell scroll area 1 of group 1 of window 1
>>                              click (first checkbox whose title contains
>> "AirPods Max")
>>                      end tell
>>              end try
>>      end tell
>> end tell
>>
>> Thanks!
>>
>> Sincerely,
>>
>> Jim
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list      (email@hidden
>> <mailto:email@hidden>)
>> Help/Unsubscribe/Update your Subscription:
>>
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
> How about a different approach?
>
> https://gist.github.com/seltzered/3b627104c8a7a39b863c
> <https://gist.github.com/seltzered/3b627104c8a7a39b863c>
>
> --set asrc to "MacBook Pro Speakers"
> --set asrc to "External Headphones"
> set asrc to "AirPods Max"
> --set asrc to "Airpods 2nd Generation"
>
> tell application "System Preferences"
>       reveal anchor "output" of pane id "com.apple.preference.sound"
>       activate
>       tell application "System Events"
>               tell process "System Preferences"
>                       select (row 1 of table 1 of scroll area 1 of tab group
> 1 of window "Sound" whose value of text field 1 is asrc)
>               end tell
>       end tell
>       quit
> end tell
>
> Sincerely,
> Laine 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: 
 >My AppleScript to choose sound output has broken in Monterey (From: Jim Krenz via AppleScript-Users <email@hidden>)
 >Re: My AppleScript to choose sound output has broken in Monterey (From: llee040--- via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: My AppleScript to choose sound output has broken in Monterey
  • Next by Date: iOS/AppleScript Guru for Hire Needed
  • Previous by thread: Re: My AppleScript to choose sound output has broken in Monterey
  • Next by thread: iOS/AppleScript Guru for Hire Needed
  • Index(es):
    • Date
    • Thread