ifpath is not working when the lister-tab is a collection

In the script below,
@ifpath:coll:// or
isn't working.

I want to remove the selected items in the destination-tab.
I often run

Please advise how to get it to work.

Script :

set dest=toggle
// Select *.* deselect
// Select postman.exe
set dest=toggle

@ifpath and similar @modifiers are evaluated before any commands run, so it would be testing the source path not the destination one.

Using scripting would be better here, as you can simply tell Opus to run a command on the destination tab:

function OnClick(clickData)
	clickData.func.command.deselect = false;
	var cmd = DOpus.Create.Command();
	if (clickData.func.sourcetab.lister.dual)
		var dest = clickData.func.desttab;
		var path = dest.path;
		if (path.Root() && path == "coll://")
			cmd.RunCommand("Delete REMOVECOLLECTION");

To not lose the selection, I'd rather use

var cmd = clickData.func.command;

That would get you the selection from the wrong side, I think.

Wouldn't the command object be empty?

A Command object can be created by the DOpusFactory.Command method. By default, this object has no source, destination, files to operate on, etc.

The script works for me, so the cmd.SetSourceTab(dest) seems to be sufficient to set up the command object, at least for the command being run.