Help with scripting

Leo's comments about the limitations of VBScript in another thread inspired me to see if I could do this in JavaScript. After a bit of hacking, the following button code now works.

function OnClick(ClickData)
{
var one = "/DopusData"; var two = "/Desktop";
var n = DOpus.Dlg.Request("Pick a target to open in a new lister",one + "|" + two);
if (n == 1) {tgt = one}; else {tgt = two};
DOpus.CreateCommand.RunCommand("Go " + tgt + " NEW=nodual,tree");
}


Regards, AB