Numbers of open tabs

Is it possible to restrict the number of open tabs in a DOpus pane? Set,say, to a maximum of 3 with a fourth then reusing one of the existing ones?

A script add-in can close the surplus tabs after opening a new one.

function OnInit(initData) { = 'LimitTabCount';
    initData.version = '2022-07-16';
    initData.url = '';
    initData.desc = 'Limit number of open tabs';
    initData.default_enable = true;
    initData.min_version = '12.0';

function OnOpenTab(openTabData) {
    var tab =;
    var tabs = tab.right ? tab.lister.tabsright : tab.lister.tabsleft;

    if (tabs.count < 4) return;

    var cmd = DOpus.Create().Command();
    for (var i = tabs.count; i > 3; --i) {
        cmd.AddLine('Go TABCLOSE TABPOS=0');



Some of the Tab Locking modes may also help. See near the bottom of!Documents/Tabs.htm

Script does the job beautifully! Thanks