This is at the end of another long thread on the Video forum, I hacked it from another post showing a script. I now have a number of layouts on the toolbar with icons :-)
Paul
import Microsoft.Win32;
import System.Windows.Forms;
import Sony.Vegas;
try
{
var wshShell = new ActiveXObject("WScript.Shell");
wshShell.SendKeys("%{d}+{1}");
}
catch(e) {MessageBox.Show(e);}
Something else that might be of interest.... you sure know the problem of how to make backups of carefully drafted window layouts? Well, one wrong Ctrl-Alt-D x and setup x is gone!
By using regmon (registry monitor) I found that all window setups are stored in registry directory [HKEY_CURRENT_USER\Software\Sony Media Software\Vegas\5.0\Metrics], as B110 (for Alt-D 0), B111, ...,, B119 (Alt-D 9). So it is basically possible to backup these 10 keys somewhere else and reactivate if anything went wrong. You can also remove these keys, which will reset the corresponding layouts to default.
One could even switch between different layout-"sets" from a script, because you can access the registry from a script. And you could swap setups between PCs or even Vegas users :-)