Judge number of files selected by the source and target is equal?

How to tell the number of files selected by the source and target is equal

'@disablenosel' modifier no related switches

If I've understood your request you only want to see if the total number of selected files in the source folder matches the total number of selected files in the destination folder?

If that's correct then this button will do the job: Selected Count.dcf (1.7 KB)

Results will be shown in the Script Log.

No checking is carried out to make sure the same files are selected, just the total numbers.

function OnClick(clickData)
{
	var intSourceSelected = 0;
	var intDestSelected = 0;
	
	if (clickData.Func.sourcetab){
		intSourceSelected = clickData.Func.sourcetab.selstats.selitems;
	}

	if (clickData.Func.desttab) {
		intDestSelected = clickData.Func.desttab.selstats.selitems;
	}
	
	if (intSourceSelected == intDestSelected) {
		DOpus.Output("Source Items = " + intSourceSelected);
		DOpus.Output("Dest Items = " + intDestSelected);
		DOpus.Output("Matching!");
	}
	else {
		DOpus.Output("Source Items = " + intSourceSelected);
		DOpus.Output("Dest Items = " + intDestSelected);
		DOpus.Output("Not Matching!");
	}
	
}

If you only care about files and not directories then change the both instances of selitems to selfiles.

I'd say @qiuqiu wants a modifier @disable_number_selected_unequal so a button becomes unavailable when the numbers of selected items in source and destination differ.

I don't think it's possible now, but I remember Leo saying that the concept of modifiers will be enhanced and expanded.

1 Like

You may be right @lxp.

Hopefully @qiuqiu cones back with more info.

At least it meant this afternoon in self-isolation went quicker. :grinning: