Last active
January 3, 2022 07:41
-
-
Save tekei/cf2a396728aea528c0069b458b950abe to your computer and use it in GitHub Desktop.
Change output audio format (frequency) script for macOS mojave 10.14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set rtn to choose from list {"44,100 Hz", "48,000 Hz", "96,000 Hz"} with prompt "出力フォーマット" | |
if (count rtn) is 0 then | |
return | |
end if | |
set fmt to item 1 of rtn | |
set target to {"BlackHole 2ch", "BlackHole 16ch", "Background Music", "Background Music (UI Sounds)", "MacBook Proのスピーカー"} | |
set processName to "Audio MIDI Setup" | |
set windowName to "オーディオ装置" | |
tell application processName to activate | |
tell application "System Events" to tell process processName | |
repeat until window windowName exists | |
delay 0.1 | |
end repeat | |
tell window windowName to tell splitter group 1 to tell scroll area 1 to tell outline 1 | |
repeat with i from 1 to count rows | |
repeat with t in target | |
if name of (static text 1 of UI element 1 of row i) is t then | |
select row i | |
tell application "System Events" to tell process processName to tell window windowName | |
click radio button 2 of tab group 1 of splitter group 1 | |
click pop up button 2 of tab group 1 of splitter group 1 | |
click menu item fmt of menu 1 of pop up button 2 of tab group 1 of splitter group 1 | |
end tell | |
end if | |
end repeat | |
end repeat | |
end tell | |
end tell | |
quit application processName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment