试了一下,下面这个验证是可用的
set AIRPODS_PRO_NAME to "你的 AirPods Pro"
set ANC to "降噪"
set TRANSPARENCY to "通透模式"
tell application "System Events"
tell process "SystemUIServer"
tell (menu bar item 1 of menu bar 1 whose description begins with "volume") -- find volume menu bar item
click
delay 0.1
tell (menu item 1 of menu 1 whose name contains AIRPODS_PRO_NAME) -- find airpods menu item
click
tell menu 1 -- open airpods menu
if value of attribute "AXMenuItemMarkChar" of menu item ANC is missing value then
click menu item ANC -- switch to ANC
else
click menu item TRANSPARENCY -- switch to Transparency
end if
end tell
end tell
end tell
end tell
end tell
来源
https://www.reddit.com/r/applescript/comments/hk2hh1/script_to_switch_airpods_pro_mode/