Select DESELECTNOMATCH has issues with unresolved items

This problem took me some time to discover, since I was testing a script and thought the issue was somewhere else.
But the problem is easily reproducible.

  1. Go to a collection.
  2. Select files/folders.
  3. Use the following button.
function OnClick(clickData) {
	DOpus.ClearOutput();
	var tab = clickData.func.sourcetab;
	if (!tab.stats.selitems) return;
	var selected = DOpus.NewVector(tab.unresolved.selected);
	for (var i = 0; i < selected.length; i++) {
		DOpus.Output(selected(i));
	}
	var cmd = clickData.func.Command;
	cmd.SetFiles(selected);
	cmd.RunCommand('Select FROMSCRIPT=unhide HIDEUNSEL DESELECTNOMATCH');
}

Nuevo Botón.dcf (1.0 KB)

The code should hide everything that isn't selected. But when SELECT DESELECTNOMATCH is used together with items that come from unresolved, it doesn't work.

You can try using the button in a regular folder, there it works as expected.
Or change unresolved to its normal variation, and there it also works.
Or remove DESELECTNOMATCH and then it also works.

Note. I know that in the example it doesn't make sense to use DESELECTNOMATCH; it's just to simplify and demonstrate the problem. When used together with FROMSCRIPT inside a real script it is indeed necessary.

Fixed in the next beta.

1 Like