function OnInit(initData) { initData.name = 'SetTimestampsFromFilenameGerman'; initData.version = '2023-08-17'; initData.default_enable = true; initData.min_version = '12.0'; } function OnAddCommands(addCmdData) { var cmd = addCmdData.AddCommand(); cmd.name = 'SetTimestampsFromFilenameGerman'; cmd.method = 'OnSetTimestampsFromFilenameGerman'; cmd.hide = false; cmd.icon = 'script'; } function OnSetTimestampsFromFilenameGerman(scriptCmdData) { var cmd = scriptCmdData.func.command; var tab = scriptCmdData.func.sourcetab; cmd.deselect = false; var map = DOpus.Create().Map(); map('jan') = '01'; map('feb') = '02'; map('mar') = '03'; map('mär') = '03'; map('apr') = '04'; map('mai') = '05'; map('jun') = '06'; map('jul') = '07'; map('aug') = '08'; map('sep') = '09'; map('okt') = '10'; map('nov') = '11'; map('dez') = '12'; var re = /.*(\d\d)-(\w\w\w)-(\d\d).*/; for (var e = new Enumerator(tab.selected); !e.atEnd(); e.moveNext()) { var item = e.item(); var tmp = item.name.match(re); if (tmp == null) continue; if (tmp.length != 4) continue; var strDate = '20' + tmp[3] + '-' + map(tmp[2].toLowerCase()) + '-' + tmp[1] + ' 00:00:00'; var cmdLine = 'SetAttr' + ' FILE="' + item + '"' + ' CREATED="' + strDate + '"' + ' MODIFIED="' + strDate + '"'; DOpus.Output(cmdLine); // cmd.RunCommand(cmdLine); } }