ScriptCommand recursive, does not "runonce"

Hello! o)

I have a weird thing going on with script commands that call script commands.

If I have 3 files selected and call a script command that does call a native/builtin command, that native command is run once for these 3 files (expected result).
If I have 3 files selected and call a script command that does call another script command, that "other" command is called 3 times for these 3 files (unexpected result).

It does not matter if the script command is calling itself or another script command (so don't mind the code using a command called "RecursionTest").

Thanks in advance on how to avoid that - if possible! o)

Convenient demo code below o):

[code]///////////////////////////////////////////////////////////////////////////////
function OnInit(data){
data.name = "Command.Generic: RecursionTest";
data.default_enable = true;
var cmd = data.AddCommand();
cmd.name = "RecursionTest";
cmd.method = "Command_RecursionTest";
}
///////////////////////////////////////////////////////////////////////////////
function Command_RecursionTest(data) {
DOpus.Output("RecursionTest():");
DOpus.Output(" cmdline : " + data.cmdline);
DOpus.Output(" sel files: " + data.func.command.files.count);

//first call, call again
if (data.cmdline.indexOf('CalledFromScriptCommand')==-1){
	data.func.command.RunCommand('RecursionTest CalledFromScriptCommand');
}

}
[/code]

Script output, notice the 3 invokations (3 files each), after the first:

Command.Generic: RecursionTest: RecursionTest(): Command.Generic: RecursionTest: cmdline : RecursionTest Command.Generic: RecursionTest: sel files: 3 Command.Generic: RecursionTest: RecursionTest(): Command.Generic: RecursionTest: cmdline : RecursionTest CalledFromScriptCommand Command.Generic: RecursionTest: sel files: 3 Command.Generic: RecursionTest: RecursionTest(): Command.Generic: RecursionTest: cmdline : RecursionTest CalledFromScriptCommand Command.Generic: RecursionTest: sel files: 3 Command.Generic: RecursionTest: RecursionTest(): Command.Generic: RecursionTest: cmdline : RecursionTest CalledFromScriptCommand Command.Generic: RecursionTest: sel files: 3

This problem still exists, I'd appreciate if you could have another look into this.
The script output above, should print "RecursionTest CalledFromScriptCommand" just once and not three times (matching the number of selected files).

To explain once more in one sentence:
If a script command A executes a script command B with "RunCommand()", the script command B will be run as often as there are items involved (selected), which to my eyes is wrong and leads to very unexpected result here.

Fixed in the next update :slight_smile:

Whoo! I'm really glad to read this! o)) I deleted things by context menu only since September because of this.

As I use the "LogCommand" addin for all major operations, which calls a command "DeleteSafetyPrompt" for delete operations, which tests what files are going to be affected and warns for specific ones, which then invokes "Delete".. I'm kind of relieved this all will work as expected soon! o))

The context menu was the only place I temporarily changed to the default behaviour, to not forget about this. o)