在Mac中使用Spotlight切换声音输出源

虽然在Mac中使用(Option+鼠标左键)点击声音图标就能选择声音输出,但是依然不够方便。

下文将描述通过Spotlight切换声音输出源的方法。(本文的方法只支持最多2种声音输出源的切换)


首先当然是写一个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

打开脚本编辑器,粘贴并运行,确保脚本能正常执行。

运行脚本

导出脚本为应用程序,并取一个好记且辨识度高的文件名,如“MyHouseExploded”

导出

在Spotlight中修改声音输出源

切换
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容