function OnInit(initData) { initData.name = 'SaveSelection'; initData.version = '2024-08-14'; initData.url = 'https://resource.dopus.com/t/remeber-the-focused-file-folder-as-you-navigate/52274/6'; initData.desc = 'Save and restore selected items'; initData.default_enable = true; initData.min_version = '12.0'; } function OnBeforeFolderChange(beforeFolderChangeData) { if (beforeFolderChangeData.initial) return; var tab = beforeFolderChangeData.tab; var tabID = String(tab.path); tab.vars.Set(tabID, tab.selected); } function OnAfterFolderChange(afterFolderChangeData) { var tab = afterFolderChangeData.tab; if (!tab) return; if (!tab.path) return; var tabID = String(tab.path); if (!tab.vars.Exists(tabID)) return; var cmd = DOpus.Create().Command(); cmd.SetSourceTab(tab); // cmd.SetFiles(tab.vars.Get(tabID)); cmd.ClearFiles(); cmd.AddFiles(tab.vars.Get(tabID)); cmd.RunCommand('Select NONE'); cmd.RunCommand('Select FROMSCRIPT SETFOCUS'); cmd.RunCommand('Select SHOWFOCUS'); }