Why CommandList.count is 42 for a fresh new Command object?

Sometimes one of my scripts tries to execute the Run method of a command, but no lines were added to it, so I see an error "A method was called unexpectedly (0x8000ffff)".

I guessed that checking the value of CommandList.count or CommandList.empty before trying to execute Run could be a way to prevent that error.

The problem is: it doesn't look like CommandList.count and CommandList.empty are working correctly (or I misunderstood something).

On the CLI in script mode, the following code returns the following output.

var cmd = DOpus.Create.Command();
DOpus.Output(String(cmd.CommandList.empty));
DOpus.Output(cmd.CommandList.count);
cmd.Clear;
cmd.ClearFiles;
cmd.AddLine("notepad.exe");
DOpus.Output(String(cmd.CommandList.empty));
DOpus.Output(cmd.CommandList.count);
false
42
false
42

To me the correct values would be more like:

true
0
false
11

Are you able to reproduce this? Is this a bug?

Command.CommandList returns a list of the internal commands, not the command lines attached to the Command object itself.

In the next update we'll add linecount (and also filecount) properties to the Command object.

1 Like