function OnInit(initData) { initData.name = 'LogGroup'; initData.version = '2023-07-06'; initData.url = 'https://resource.dopus.com/t/grouping-of-file-and-folder-names/44942'; initData.desc = ''; initData.default_enable = true; initData.min_version = '12.0'; } function OnAddColumns(addColData) { var col = addColData.AddColumn(); col.name = 'LogGroup'; col.justify = 'right'; col.method = 'OnColumn'; } function OnColumn(scriptColData) { var item = scriptColData.item; if (item.is_dir) return; var itemNo = item.name_stem.replace(/0*(\d+).*/, '$1'); if (itemNo == '') { scriptColData.value = 'none'; return; } var groupSize = Math.pow(10, itemNo.length - 1); if (groupSize < 10) groupSize = 10; var start = Math.floor(Number(itemNo) / groupSize) * groupSize; var end = start + groupSize - 1; scriptColData.value = start + '..' + end; }