Get the Sound Output Device Name with AppleScript
Just to help out a bit more:

In your main user directory /home// create a directory named 'bin' and put  SwitchAudioSource in there.

Here's some AppleScript which switches back and forth between two sources, the default 'headphone' mini jack output on the back of my Mac Mini (a laptop should be different), and my Sennheiser USB headsest.

Call me 'Captain Obvious', but here you go:

`on run

set theSwitch to "~/bin/SwitchAudioSource"
set theSource to do shell script theSwitch &amp; " -c"

if theSource = "Built-in Output" then
    do shell script theSwitch &amp; " -s \"Sennheiser USB headset\""
else
    do shell script theSwitch &amp; " -s \"Built-in Output\""
end if


end run`