Display index number on the tabs,add an option to <Preferences/Folder Tabs/options>

Please add an option to Display index number on the tabs , like this:


add index number and colon(or other custom character) to the start.
This can help me quickly determine which tab to activate with a shortcut key.

Try this script. Maybe that's already good enough?

function OnInit(initData) {
    initData.name = 'AddTabIndex';
    initData.version = '2026-05-08';
    initData.url = 'https://resource.dopus.com/t/display-index-number-on-the-tabs-add-an-option-to-preferences-folder-tabs-options/59359/2';
    initData.desc = 'Add index to tab labels';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function AddIndexToTabs(lst) {
    var cmd = DOpus.Create().Command();

    AddIndex(lst.tabsleft);

    if (lst.dual) {
        AddIndex(lst.tabsright);
    }

    function AddIndex(tabs) {
        for (var i = 0; i < tabs.count; i++) {
            var tab = tabs(i);
            cmd.SetSourceTab(tab);
            cmd.RunCommand('Go TABNAME');
            tab.Update();
            var oldLabel = tab.displayed_label;
            var newLabel = (i + 1) + ':' + oldLabel.replace(/^\d+:/, '');
            if (oldLabel == newLabel) continue;
            cmd.RunCommand('Go TABNAME="' + newLabel + '"');
        }
    }
}

function OnActivateTab(activateTabData) {
    // Called when a tab is activated
    AddIndexToTabs(activateTabData.tab.lister);
}

function OnOpenLister(openListerData) {
    // Called when a new Lister is opened
    if (!openListerData.after) return;
    AddIndexToTabs(openListerData.lister);
}

function OnActivateLister(activateListerData) {
    // Called when a Lister is activated
    if (!activateListerData.active) return;
    AddIndexToTabs(activateListerData.lister);
}

function OnOpenTab(openTabData) {
    // Called when a new tab is opened
    AddIndexToTabs(openTabData.tab.lister);
}


function OnAfterFolderChange(afterFolderChangeData) {
    // Called after a new folder is read in a tab
    AddIndexToTabs(afterFolderChangeData.tab.lister);
}

function OnSourceDestChange(sourceDestData) {
    // Called when the source and destination are changed
    AddIndexToTabs(sourceDestData.tab.lister);
}

Save EventAddTabIndex.js.txt to   

%appdata%\GPSoftware\Directory Opus\Script AddIns

How to use buttons and scripts from this forum

I have created similar scripts before,dealing with it is not that simple...
There are some issues:
when you close a tab, all indexs need to be updated. There is a significant delay in refreshing the display.
And renaming a tab by slowly double-click (Go TABNAME) will interfere the index number.

so the index number should be generated internally as an inherent part, and should not be overwritten by renaming tab.

We'll add this in the next beta. Thanks for the suggestion!

Thank you!
The separator after the index number should ideally be customizable by the user, such as:
a space / a dash(-) / vertical line‌(|) ‌‌/ other, or even no separator.

i like parentheses )

Nothing less than a new Evaluator context will be acceptable! :wink: