雖然在Mac中使用(Option+鼠標(biāo)左鍵)點擊聲音圖標(biāo)就能選擇聲音輸出功咒,但是依然不夠方便蒸殿。
下文將描述通過Spotlight切換聲音輸出源的方法比默。(本文的方法只支持最多2種聲音輸出源的切換)
首先當(dāng)然是寫一個Apple Script宾毒,用來一鍵切換聲音輸出源驼修,腳本如下:
try
? ? tell application "System Preferences"
? ? ? ? reveal anchor "output" of pane id "com.apple.preference.sound"
? ? end tell
? ? tell application "System Events" to tell process "System Preferences"
? ? ? ? tell table 1 of scroll area 1 of tab group 1 of window 1
? ? ? ? ? ? set selected_row to (first UI element whose selected is false)
? ? ? ? ? ? set currentOutput to value of text field 1 of selected_row as text
? ? ? ? ? ? select (row 1 where value of text field 1 is currentOutput)
? ? ? ? end tell
? ? end tell
? ? quit application "System Preferences"
end try
打開腳本編輯器,粘貼并運行诈铛,確保腳本能正常執(zhí)行乙各。
導(dǎo)出腳本為應(yīng)用程序,并取一個好記且辨識度高的文件名幢竹,如“MyHouseExploded”
在Spotlight中修改聲音輸出源