Here's the script/button ready for dragging to a toolbar:
Close all except source_dest.dcf (5.52 KB)
For reference, the JScript code which is in the .dcf so you & others can see what it does without having to download and edit the file:
[code]function OnClick(clickData)
{
var funcListerId = clickData.func.sourcetab.lister + 0; // Coerce to numeric ID.
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection.
cmd.ClearFiles(); // Ignore file/folder selection.
for(var eListers = new Enumerator(DOpus.listers); !eListers.atEnd(); eListers.moveNext())
{
var lister = eListers.item();
if ((lister+0) == funcListerId)
continue; // Assume we never want to close the lister the command launched from.
cmd.SetSourceTab(lister.activetab);
// If it's dual-display, assume we want to close it.
// If it's single-display, check if it's source or dest.
if (lister.dual == 0)
{
if (!cmd.IsSet("STATE=Off"))
continue; // It's source or dest, so don't close it.
}
cmd.RunCommand("Close");
}
}[/code]