How do I iterate through items right-click-drag-and-dropped context menu items?

When files are simply left-click dragged from one tab to another, I have no problem iterating the list via data.sourcetab.selected_files(i).

But if I select files and then right-click-drag them, I cannot use data.sourcetab.selected_files(i) (data.sourcetab.stats.selfiles is 0, no matter how many files I dragged.)

How do I get the list of files I dropped?

Thanks

There isn't a source tab in that context, but the list of files is included in the Command object that's given to the script:

function OnClick(clickData)
{
	var cmd = clickData.func.command;
	DOpus.Output("Selected items:");
	if (cmd.files.count == 0)
	{
		DOpus.Output("  (none)");
	}
	else
	{
		for (var eSel = new Enumerator(cmd.files); !eSel.atEnd(); eSel.moveNext())
		{
			DOpus.Output("  " + eSel.item().RealPath);
		}
	}
}

(This also works in the normal case where there is a source tab.)

Great! Thank you. Works perfectly.

For anyone else needing a vbScript version:

for each item in cmd.files
   msgbox item.name
   msgbox item.path
   msgbox cmd.dest
next