How to determine sound input/output device?

I’ve got a question that I haven’t see before here: I know you can use System Events scripting to change the output (or input) device. BUT…is there a way (besides having to run SE) that you can just determine which device is currently active?

My headphones are great but they are VERY sensitive - when they’re plugged in I have to set the volume down to the lowest setting (plus crank down iTunes’ volume to about 2/3) or I blow my eardrums out.

Just curious if there is a way programmatically to determine the device and set the volume accordingly.

Hi, Kevin;

I think this is what you’re talking about:

tell application "System Preferences" to reveal anchor "output" of pane id ""
tell application "System Events" to tell (table 1 of scroll area 1 of tab group 1 of window "Sound" of application process "System Preferences")
	set S to selected of rows
	if item 1 of S is false then
		select row 1
		set msg to "External Speakers"
		select row 3
		set msg to "Earphones"
	end if
end tell
tell application "System Preferences" to quit
display dialog msg giving up after 5 buttons {"OK"} default button 1

Thanks Adam. I was afraid it would be something similar to that. I was hoping that there might be a value in the defaults that would carry that info. Then all I would have to do was a quick shell script without having to launch System Prefs.

Ah well. As Mick Jagger observed, “You can’t always get what you want.”