This add-in saves and restores the quickfilter settings per folder when navigating in a tab. It's useful if you don't want to keep a quickfilter in a newly opened folder (Preferences / File Displays / FAYT and Filter Bar Options / Clear Quick filter automatically when changing folders), but like to automatically restore a quickfilter when coming back to a previously used folder.
The quickfilter definitions are stored with the tab, so they won't affect folders in other tabs and they will be gone once the tab is closed.
function OnInit(initData) {
initData.name = 'SaveQuickFilter';
initData.version = '2023-02-19';
initData.copyright = '';
initData.url = 'https://resource.dopus.com/t/save-and-restore-quickfilter-settings/43718';
initData.desc = 'Save and restore QuickFilter settings';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnBeforeFolderChange(beforeFolderChangeData) {
var tab = beforeFolderChangeData.tab;
if (tab.quickfilter.filter == '') return;
tab.vars.Set(String(tab.path), tab.quickfilter.filter);
}
function OnAfterFolderChange(afterFolderChangeData) {
var tab = afterFolderChangeData.tab;
var tabPath = String(tab.path);
if (tabPath == 'undefined') return; // this seems to potentially be the case when Layouts or Tabgroups get opened
if (!tab.vars.Exists(tabPath)) return;
var cmd = DOpus.Create().Command();
cmd.SetSourceTab(tab);
cmd.RunCommand('Set QUICKFILTER="' + tab.vars.Get(tabPath) + '"');
}
Closing the tab and opening a new one should clear any filter saved for that tab. (At least, based on my reading of the root post.)
(There are also some add-ins on here that let you look and manage at variables in general, which could be used to delete the tab variable that stores the filter. I'm not sure which is the best one these days, but the first few posts here have some options: Search results for 'variables #buttons-scripts' - Directory Opus Resource Centre )
Thanks. Global Variable Buttons and Management Dialog are good.
but i see no variables for this script with them. there's for EveryThingSize, some others, but not for this script.
I agree that this is worth doing.
I have added it to my navigation toolbar with a few changes.
I have modified this to be an icon toggle run from a tab focused variable.
The highlighting doesn't show much where I have the button placed, but the button still needs the code AFAIK for now.
The default search box doesn't save the search keyword which windows file explorer does. Its a request if possible please write a script for the default search box (which at the toolbar not the find pane) for remember search keyword
This is super useful! Sort of makes we wish we had Excel like dropdown arrows to the right of the text label of each column header that would bring up a dropdown menu with the various filtering options like manual text input and a checkbox list of all the different values in that column.