Re: My AppleScript to choose sound output has broken in Monterey
Re: My AppleScript to choose sound output has broken in Monterey
- Subject: Re: My AppleScript to choose sound output has broken in Monterey
- From: llee040--- via AppleScript-Users <email@hidden>
- Date: Fri, 5 Nov 2021 21:47:02 -0500
> On Nov 5, 2021, at 8:13 PM, Jim Krenz via AppleScript-Users
> <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)
> 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
--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