Give this a try.
function OnInit(initData) {
initData.name = 'TabRenameToClient';
initData.version = '2022-09-28';
initData.url = 'https://resource.dopus.com/t/script-for-tab-naming/42310';
initData.desc = 'Rename Tab to client folder';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnAfterFolderChange(afterFolderChangeData) {
if (!afterFolderChangeData.result) return;
var tab = afterFolderChangeData.tab;
var vecPath = DOpus.FSUtil().Resolve(tab.path).Split();
if (vecPath.count < 3) return;
if (vecPath(0).toLowerCase() != 'z:\\') return;
if (vecPath(1).toLowerCase() != 'files') return;
var newTabName = vecPath(2);
if (newTabName == tab.displayed_label) return;
var cmd = DOpus.Create().Command();
cmd.SetSourceTab(tab);
cmd.RunCommand('Go TABNAME="' + newTabName + '"');
}