function OnClick(clickData)
{
if (clickData.func.sourcetab.selected.count != 1)
return;
nameStem = clickData.func.sourcetab.selected(0).name_stem_m.toLowerCase();
DOpus.Output(nameStem);
var cmd = clickData.func.command;
cmd.ClearFiles();
cmd.RunCommand('Select "LaTeX aux-tmp" FILTER');
clickData.func.sourcetab.update();
var needToDeselect = false;
for (var eSel = new Enumerator(clickData.func.sourcetab.selected); !eSel.atEnd(); eSel.moveNext())
{
var item = eSel.item();
if (item.name_stem_m.toLowerCase() !== nameStem)
{
cmd.AddFile(item);
needToDeselect = true;
}
}
if (needToDeselect)
{
cmd.RunCommand("Select DESELECT FROMSCRIPT");
}
}
If the filter was inverted, so it matches everything except *.(aux|toc|log) then the script would not be needed as it could be done with two more simple commands. Similarly if you put the wildcard directly in the button rather than use a filter. But the above method is probably what you want if you want to use a filter and don't want to invert it or maintain a second filter that is inverted.