Macs have a peculiarity, logical and meaningful on their native hardware, but annoying when using
non-standard configurations : the sound goes either to the speakers or to the headphones.
There is only one 3.5 connector: I plugged in the headphones β the speakers stopped, pulled out β the sound came back.
It is correct and convenient. If only the system unit does not stand under the table and the sound card does not have much more outputs.
In order not to launch the System Settings manually each time and dig into them, I wrote a small Apple script:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window ""
click radio button ""
if (selected of row 2 of table 1 of scroll area 1) then
set selected of row 1 of table 1 of scroll area 1 to true
else
set selected of row 2 of table 1 of scroll area 1 to true
end if
end tell
end tell
end tell
tell application "System Preferences" to quit
A ready-made script, packaged in a program format (convenient to keep in the dock)
can be downloaded here .
Most likely, the outputs of the sound card to which your speakers and headphones are connected will be different from mine.
This problem is easy to solve as follows:
- Right-click on the program icon β Show package contents
- Open file Contents / Resources / Scripts / main.scrt
- Change the rows βrow 2β and βrow 1β to those that are needed. (You can open the "System Settings" and see in which lines the necessary menu items are located)
- Save the resulting file and start using

As can be seen from the names of the menu items, he works in the Russian localization of Leopard. If you want him to teach any other language - rewrite the words "Sound" and "Output" to those used in localization.
The thing is primitive, but it saves time and nerves.