Thanks, Fixed! The variable needs to be declared first though in the command. Is that just how the Command.vars work versus the other scopes? With the others you can set them only in the script and they are available in the command without ever using @set. Example below.
Button
//@set $var_test=testing123
// Following line works too even though it should remove the var
//@set $var_test
VarTest
// Output vars set from script
@output:{$glob:var_test} // Success
@output:{$lst:var_test} // Success
@output:{$src:var_test} // Success
@output:{$var_test} // Failed unless it's set first (commented above)
// Remove vars set from script
@set $glob:var_test
@set $lst:var_test
@set $src:var_test
Script
function OnInit(init)
{
init.name = "Command local var test";
init.default_enable = true;
var cmd = init.AddCommand();
cmd.name = "VarTest";
cmd.label = "VarTest";
cmd.method = "VarTest";
return false;
}
function VarTest(data)
{
DOpus.vars("var_test") = "GlobalVar";
DOpus.Listers(0).vars("var_test") = "ListerVar";
data.Func.sourcetab.vars("var_test") = "SourceVar";
data.Func.Command.vars("var_test") = "CommandVar";
}
Output from button:
GlobalVar
ListerVar
SourceVar
(blank line)