Ha, applescript...
Soundflower (the decide in the drop down of the screen grab) is a well known kernel extension that allows for capture or redirection of audio. For example, ScreenFlow
http://www.telestream.net/screen-flow/ uses it to capture the output and input audio devices for recording into the screen captures.