I don't remember if this was the case before. A bit difficult to explain with words alone, that's why a video is better.
If in a folder with nested items, I use a Select command to hide some of them, when using Select NOPATTERN SHOWHIDDEN to show them again, the nested items remain hidden. One needs to press the folder expansion pin several times, to show the hidden items again eventually.
Sorry @Jon , in v13.4.6, something similar happens. There are items that, after being hidden and then shown, remain hidden. I don't remember if this happened in 13.4.5 (I don't have a copy to test and it seems that it's no longer available for download).
To test (the example is a bit convoluted):
function OnClick(clickData) {
var cmd = clickData.func.command;
cmd.ClearFiles();
var tab = clickData.func.sourcetab;
cmd.RunCommand('Go "/home"'); //Go to DOpus home dir
tab.Update();
cmd.SetFiles(tab.dirs);
cmd.RunCommand('Go EXPANDBRANCH=script'); //expand all dirs to show nested items
tab.Update();
var set_dll = DOpus.Create.StringSet();
var set_else = DOpus.Create.StringSet();
var item;
DOpus.Delay(1000);
DOpus.Output('total visible items :' + tab.stats.items);
for (var i = 0; i < tab.files.count; i++) {
item = tab.files(i);
if (item.ext === '.dll') { //store only the dll's
set_dll.insert(item + ''); //try strings only too
//set_dll.insert(item);
if (item.nested) { //store parent dir
set_dll.insert(item.path + ''); //try strings only too
//set_dll.insert(item.path);
}
}
else { //store all the others items
set_else.insert(item + ''); //try strings only too
//set_else.insert(item);
if (item.nested) {
set_else.insert(item.path + ''); //try strings only too
//set_else.insert(item.path);
}
}
}
cmd.SetFiles(set_dll); //show only the dll's first, hide the rest
DOpus.Output('total items in cmd :' + cmd.filecount);
cmd.RunCommand('Select FROMSCRIPT=unhide HIDEUNSEL DESELECTNOMATCH');
cmd.RunCommand('Select FIRST');
DOpus.Delay(1000);
tab.update();
DOpus.Output('total visible items :' + tab.stats.items);
cmd.SetFiles(set_else); //show the rest, hide the dll's
DOpus.Output('total items in cmd :' + cmd.filecount);
cmd.RunCommand('Select FROMSCRIPT=unhide HIDEUNSEL DESELECTNOMATCH');
cmd.RunCommand('Select FIRST');
DOpus.Delay(1000);
tab.update();
DOpus.Output('total visible items :' + tab.stats.items);
cmd.RunCommand('Select NOPATTERN SHOWHIDDEN'); //show all hidden items
tab.update();
DOpus.Output('total visible items :' + tab.stats.items);
}
The visible items at the beginning (after the expansion) and the end are not equal, and those hidden are not getting visible easily, unless you refresh the tab.
@Jon thanks. I think there are still some issues with Select (and maybe it's because of FROMSCRIPT=unhide). A quick test ready to use:
function OnClick(clickData) {
DOpus.ClearOutput();
var cmd = clickData.func.command;
cmd.ClearFiles();
var tab = clickData.func.sourcetab;
cmd.RunCommand('Go "/home"'); //Go to DOpus home dir
tab.Update();
cmd.SetFiles(tab.dirs);
cmd.RunCommand('Go EXPANDBRANCH=script'); //expand all dirs to show nested items
tab.Update();
var set_exe = DOpus.Create.StringSet();
var set_else = DOpus.Create.StringSet();
var item;
DOpus.Delay(1000);
DOpus.Output('total visible items :' + tab.stats.items);
for (var i = 0; i < tab.files.count; i++) {
item = tab.files(i);
if (item.ext === '.exe') { //store only the exe's
set_exe.insert(item + ''); //try strings only too
if (item.nested) //store parent dir
set_exe.insert(item.path + ''); //try strings only too
}
else { //store all the others items
set_else.insert(item + ''); //try strings only too
if (item.nested)
set_else.insert(item.path + ''); //try strings only too
}
}
cmd.SetFiles(set_exe); //show only the exe's first, hide the rest
DOpus.Output('EXE: total items in cmd :' + cmd.filecount);
cmd.RunCommand('Select FROMSCRIPT=unhide HIDEUNSEL DESELECTNOMATCH');
cmd.RunCommand('Select FIRST');
DOpus.Delay(1500);
tab.update();
DOpus.Output('EXE: total visible items :' + tab.stats.items);
cmd.SetFiles(set_else); //show the rest, hide the exe's
DOpus.Output('NON EXE: total items in cmd :' + cmd.filecount);
cmd.RunCommand('Select FROMSCRIPT=unhide HIDEUNSEL DESELECTNOMATCH');
cmd.RunCommand('Select FIRST');
DOpus.Delay(1500);
tab.update();
DOpus.Output('NON EXE: total visible items :' + tab.stats.items);
DOpus.Output('NON EXE: total hidden items :' + tab.hidden.count);
}
Sorry , in my defense, the issue is kind of the same from the very first post.
Last one I found (or report), I promise. This one is related with grouped flatview, Select FROMSCRIPT=unhide is not used
function OnClick(clickData) {
DOpus.ClearOutput();
var cmd = clickData.func.command;
cmd.ClearFiles();
var tab = clickData.func.sourcetab;
cmd.RunCommand('Go "/home"'); //Go to DOpus home dir
cmd.RunCommand('Set FLATVIEW=On,Grouped'); //flat view grouped
tab.Update();
var set_exe = DOpus.Create.StringSet();
DOpus.Delay(1000);
DOpus.Output('total visible items :' + tab.stats.items);
DOpus.Output('total hidden items :' + tab.hidden.count);
for (var i = 0; i < tab.files.count; i++) {
item = tab.files(i);
if (item.ext === '.exe') { //store only the exe's
set_exe.insert(item + ''); //try strings only too
if (item.path.def_value != tab.path.def_value) //store parent dir
set_exe.insert(item.path + ''); //try strings only too
}
}
cmd.SetFiles(set_exe); //show only the exe's first, hide the rest
DOpus.Output('total items in cmd :' + cmd.filecount);
cmd.RunCommand('Select FROMSCRIPT HIDEUNSEL DESELECTNOMATCH');
cmd.RunCommand('Select FIRST');
DOpus.Delay(1500);
cmd.RunCommand('Select NOPATTERN SHOWHIDDEN'); //show all the hidden items
DOpus.Delay(500);
tab.update();
DOpus.Output('total visible items :' + tab.stats.items);
DOpus.Output('total hidden items :' + tab.hidden.count);
}
As XML
<?xml version="1.0"?>
<button backcol="none" display="icon" label_pos="right" textcol="none">
<label>Select test</label>
<icon1>#newcommand</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>function OnClick(clickData) {</instruction>
<instruction> DOpus.ClearOutput();</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> cmd.ClearFiles();</instruction>
<instruction> var tab = clickData.func.sourcetab;</instruction>
<instruction> cmd.RunCommand('Go "/home"'); //Go to DOpus home dir</instruction>
<instruction> cmd.RunCommand('Set FLATVIEW=On,Grouped'); //flat view grouped</instruction>
<instruction> tab.Update();</instruction>
<instruction> var set_exe = DOpus.Create.StringSet();</instruction>
<instruction> DOpus.Delay(1000);</instruction>
<instruction> DOpus.Output('total visible items :' + tab.stats.items);</instruction>
<instruction> DOpus.Output('total hidden items :' + tab.hidden.count);</instruction>
<instruction> for (var i = 0; i < tab.files.count; i++) {</instruction>
<instruction> item = tab.files(i);</instruction>
<instruction> if (item.ext === '.exe') { //store only the exe's</instruction>
<instruction> set_exe.insert(item + ''); //try strings only too</instruction>
<instruction> if (item.path.def_value != tab.path.def_value) //store parent dir</instruction>
<instruction> set_exe.insert(item.path + ''); //try strings only too</instruction>
<instruction> } </instruction>
<instruction> }</instruction>
<instruction> cmd.SetFiles(set_exe); //show only the exe's first, hide the rest</instruction>
<instruction> DOpus.Output('total items in cmd :' + cmd.filecount);</instruction>
<instruction> cmd.RunCommand('Select FROMSCRIPT HIDEUNSEL DESELECTNOMATCH');</instruction>
<instruction> cmd.RunCommand('Select FIRST');</instruction>
<instruction> DOpus.Delay(1500);</instruction>
<instruction> cmd.RunCommand('Select NOPATTERN SHOWHIDDEN'); //show all the hidden items</instruction>
<instruction> DOpus.Delay(500);</instruction>
<instruction> tab.update();</instruction>
<instruction> DOpus.Output('total visible items :' + tab.stats.items);</instruction>
<instruction> DOpus.Output('total hidden items :' + tab.hidden.count);</instruction>
<instruction>}</instruction>
</function>
</button>
In the end, Select NOPATTERN SHOWHIDDEN is unable to revert hidden state.