Reputation: 1773
I have an automator app that switch the audio between mono and stereo. It used to work but Mojave update seems to break it. I have given it accessibility permission, but still no luck. What might be the problem?
tell application "System Preferences"
launch
reveal anchor "Hearing" of pane id "com.apple.preference.universalaccess"
tell application "System Events" to tell process "System Preferences"
delay 0.5
click the checkbox "Play stereo audio as mono" of window "Accessibility"
end tell
end tell
tell application "System Preferences" to quit
The error message is as following:
The action “Run AppleScript” encountered an error: “System Events got an error: Can’t get checkbox "Play stereo audio as mono" of window "Accessibility" of process "System Preferences".”
Thank you in advance!
Upvotes: 1
Views: 1705
Reputation: 3142
Try giving this a shot...
tell application "System Preferences"
reveal anchor "Hearing" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events"
repeat until exists of checkbox "Play stereo audio as mono" of group 1 of window "Accessibility" of application process "System Preferences"
delay 0.1
end repeat
click checkbox "Play stereo audio as mono" of group 1 of window "Accessibility" of application process "System Preferences"
end tell
tell application "System Preferences" to quit
Upvotes: 1