I have no idea what I'm doing wrong. I am trying to populate the dropdown in the combo box. I tried using an array but that didn't work so then I tried making the array into a vector before setting the value because this page says Vector is a valid datatype https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Scripting/Control.htm
dlg.Control("combo").value = getPaths();
If I do I quick test the result is -1 instead of the options from the vector
DOpus.Output("value: " + dlg.Control("combo").value);
Full test code.
function OnInit(initData) {
initData.name = "TestHelperAddIn";
initData.version = "1.0";
initData.copyright = "(c) 2023 chris";
initData.desc = "TestHelperAddIn";
initData.default_enable = true;
initData.min_version = "12.0";
// Create a new ScriptCommand object and initialize it to add the command to Opus
var cmd = initData.AddCommand();
cmd.name = initData.name;
cmd.method = "start";
cmd.desc = initData.desc;
cmd.label = "TestHelperAddIn";
//For arguments Ex: DazMove funcname to "folder"
cmd.template = "items/k,";
}
function start(scriptCmdData) {
DOpus.ClearOutput();
var cmd = scriptCmdData.func.command;
var dlg = cmd.Dlg;
dlg.template = "SelectDestination";
dlg.detach = true;
dlg.Show;
dlg.Control("combo").value = getPaths();
while (true) {
var Msg = dlg.GetMsg();
if (!Msg.result) break;
DOpus.Output("Msg Event = " + Msg.event);
}
DOpus.Output("Return code = " + dlg.result);
}
function getPaths() {
var choices = [
"\\\\DESKTOP\\nas\\foo",
"\\\\Desktop\\nas\\bar",
"\\\\Desktop\\nas\\test",
"\\\\AMD\\QuadRed\\foo",
"\\\\AMD\\QuadRed\\bar",
];
var vChoices = DOpus.Create.Vector();
vChoices.append(choices);
return vChoices;
}
==SCRIPT RESOURCES
<resources>
<resource name="SelectDestination" type="dialog">
<dialog fontsize="8" height="120" lang="english" resize="yes" width="550">
<control halign="left" height="8" name="static1" title="Source Folder:" type="static" valign="top" width="50" x="18" y="18" />
<control height="30" name="group1" title="Source" type="group" width="540" x="5" y="6" />
<control halign="left" height="8" name="SourceFolder" title="sourcefolder" type="static" valign="top" width="440" x="72" y="18" />
<control height="30" name="group2" title="Search Field" type="group" width="540" x="5" y="36" />
<control halign="left" height="12" name="searchbox" title="search" type="edit" width="276" x="132" y="48" />
<control height="40" name="combo" type="combo" width="540" x="6" y="72" />
<control close="1" height="14" name="button1" title="Move Selected" type="button" width="61" x="162" y="96" />
<control close="2" height="14" name="button2" title="Move Source Folder" type="button" width="73" x="234" y="96" />
<control close="0" default="yes" height="14" name="button3" title="cancel" type="button" width="50" x="318" y="96" />
<control height="14" name="search" title="Search" type="button" width="50" x="426" y="48" />
</dialog>
</resource>
</resources>