Calling a popupdialog from a folder context menu (via filetypes => all folders) shows a file function dialog. If this command is called from any menu button, it only shows the popup dialog.
function OnInit(initData)
{
initData.name = "test";
initData.version = "1.0";
initData.desc = "";
initData.default_enable = true;
initData.min_version = "12.0";
var cmd = initData.AddCommand();
cmd.name = "test";
cmd.method = "Ontest";
cmd.desc = "";
cmd.label = "test";
cmd.template = "";
cmd.hide = false;
cmd.icon = "script";
}
// Implement the test command
function Ontest(scriptCmdData)
{
var dlg = scriptCmdData.func.Dlg;
var menu = [];
var choices = [];
for (var i = 0; i < 5; i++)
{
menu[i] = i == 0 ? 1 : 0;
choices[i] = String(i);
}
dlg.choices = choices;
dlg.menu = menu;
dlg.selection = 0;
var result = dlg.Show();
if (result > 0)
return choices[result - 1];
}