Display or select unique or distinct files

If you are looking at a Find Results collection, this button will remove from the collection all files that have the same file name as a previous item:

Note: This only works with Find (e.g. Tools > Find Files). It won't work with Windows Search (e.g. the field at the top right of the lister), as you can't modify the results of a Windows Search query after it has been run, other than by modifying the query and running it again.

Script code for reference:

function OnClick(clickData)
{
	var cmd = clickData.func.command;
	cmd.ClearFiles();

	var names = DOpus.Create.StringSetI();

	for (var eSel = new Enumerator(clickData.func.sourcetab.files); !eSel.atEnd(); eSel.moveNext())
	{
		var item = eSel.item();
		if (!names.insert(item.name))
		{
			cmd.AddFile(item);
		}
	}

	cmd.RunCommand("Delete REMOVECOLLECTION");
}