Found this while debugging a longer script, this is the reduced-to-the-max version.
- Select a few files
-
Select INVERT
will toggle between the selected und the unselected files - Run the script
-
Select INVERT
will still toggle - If open, close the log
- Un-comment the line and run the script again
- The files are still selected, but they have lost the focus.
Select INVERT
will not toggle. Focus can be regained by going to a different Lister and back. - Select a few other files, leave the log open
- Run the script
-
Select INVERT
will toggle - BTW, files selected via
Select FROMSCRIPT
are equally affected
Conclusion: see topic title.
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
cmd.deselect = false;
// cmd.RunCommand('Set UTILITY=otherlog');
DOpus.ClearOutput();
for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
var item = e.item();
DOpus.Output(item);
}
}
<?xml version="1.0"?>
<button backcol="none" display="label" label_pos="right" textcol="none">
<label>TestOpenLog</label>
<icon1>#empty</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> var tab = clickData.func.sourcetab;</instruction>
<instruction> cmd.deselect = false;</instruction>
<instruction> // cmd.RunCommand('Set UTILITY=otherlog');</instruction>
<instruction> DOpus.ClearOutput();</instruction>
<instruction />
<instruction> for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {</instruction>
<instruction> var item = e.item();</instruction>
<instruction> DOpus.Output(item);</instruction>
<instruction> }</instruction>
<instruction>}</instruction>
</function>
</button>