All pastes #95369 Raw Edit

xSmurf

public text v1 · immutable
#95369 ·published 2006-07-21 23:24 UTC
rendered paste body
on getSoundSources()
	set sourceList to "" as list
	
	using terms from application "System Preferences" of machine "eppc://localhost"
		tell application "System Preferences"
			activate
			set current pane to pane "com.apple.preference.sound"
			reveal (first anchor of current pane whose name is "output")
		end tell
	end using terms from
	
	tell application "System Events" of machine "eppc://localhost"
		tell process "System Preferences"
			using terms from application "System Events" of machine "eppc://localhost"
				set theRows to every row of table 1 of scroll area 1 of tab group 1 of window 1
				repeat with aRow in theRows
					set end of sourceList to (value of text field 1 of aRow as text)
				end repeat
			end using terms from
		end tell
		tell application "System Preferences" of machine "eppc://localhost" to quit
	end tell
	
	return sourceList
end getSoundSources