abr
February 10, 2018, 6:48pm
1
I'm using lots of linked files, most of them being locked. But sometimes it would be very handy, if we could toggle all locked states to "no lock" temporarily. I know, that we already have commands to change the lock states. So basically i am requesting a mode to remove the locks generally, without having to use the keyboard command for maybe four tabs (two linked pairs of tabs) one by one.
When i restart my standard lister, all would be reset through Go Tabgroupload to normal.
Leo
February 11, 2018, 1:49am
2
This button will unlock all tabs in the current lister:
Unlock All Tabs.dcf (4.0 KB)
Script code for reference:
function OnClick(clickData)
{
var cmd = clickData.func.command;
cmd.deselect = false;
cmd.ClearFiles();
var rightActive = clickData.func.sourcetab.right;
var leftTabIndex = -1;
var rightTabIndex = -1;
var tabIndex = 0;
var right = false;
for (var eTab = new Enumerator(clickData.func.sourcetab.lister.tabs); !eTab.atEnd(); eTab.moveNext())
{
var tab = eTab.item();
if (!right && tab.right)
{
right = true;
tabIndex = 0;
}
if (tab.visible)
{
if (tab.right)
{
rightTabIndex = tabIndex;
break;
}
else
{
leftTabIndex = tabIndex;
}
}
++tabIndex;
}
tabIndex = 0;
right = false;
cmd.RunCommand("Set SOURCE=left");
for (var eTab = new Enumerator(clickData.func.sourcetab.lister.tabs); !eTab.atEnd(); eTab.moveNext())
{
var tab = eTab.item();
if (!right && tab.right)
{
right = true;
tabIndex = 0;
cmd.RunCommand("Set SOURCE=right");
}
if (tab.lock != "off")
{
cmd.SetSourceTab(tab);
cmd.RunCommand("Go TABSELECT=" + tabIndex);
cmd.RunCommand("Go TABLOCK=off");
}
++tabIndex;
}
if (rightActive && leftTabIndex != -1)
{
cmd.RunCommand("Set SOURCE=left");
cmd.RunCommand("Go TABSELECT=" + leftTabIndex);
}
if (rightTabIndex != -1)
{
cmd.RunCommand("Set SOURCE=right");
cmd.RunCommand("Go TABSELECT=" + rightTabIndex);
}
if (!rightActive && leftTabIndex != -1)
{
cmd.RunCommand("Set SOURCE=left");
cmd.RunCommand("Go TABSELECT=" + leftTabIndex);
}
}
abr
February 11, 2018, 2:15am
3
Thanks a lot, Leo. I just tested the button, it works perfectly!
1 Like
Leo
July 18, 2024, 2:33am
4
Here's a better version of that script, which doesn't activate all the tabs while unlocking them:
Unlock All Tabs.dcf (1.0 KB)
function OnClick(clickData)
{
var lister = clickData.func.sourcetab.lister;
var cmd = clickData.func.command;
cmd.deselect = false;
cmd.ClearFiles();
cmd.SetSourceTab(lister.tabsleft(0));
cmd.RunCommand("Go TABLOCK=off,all");
if (lister.dual)
{
cmd.SetSourceTab(lister.tabsright(0));
cmd.RunCommand("Go TABLOCK=off,all");
}
}
2 Likes