TabRescue : Quickly restore your closed tabs

TabRescue is a script add-in command for Directory Opus that implements a new system to manage recently closed tabs.

  • Lets you save a history of closed tabs per Lister.
  • Shows a list of the last x closed tabs, letting you reopen them easily with modifier-key support.
  • Maximum saved-tabs count is configurable per Lister.
  • You can customize how a tab is reopened.
  • Multiple Listers can be handled simultaneously.

:warning: IMPORTANT: READ BEFORE PROCEEDING

This script is provided "as is" and without any kind of warranty.
It was developed during my spare time and has not been extensively tested, so it is presented as a testing version.
The user assumes full responsibility for its use and acknowledges that the author is not liable for any failures or data loss.
Please note this is a work in progress, so bugs may occur.
Feedback on possible improvements or bug reports is highly appreciated.

How to Install

:warning: IMPORTANT: Requires DOpus v13.15.2 or later
Download the file below. Then go to Script Management (or run Prefs SCRIPTINSTALL) and select the downloaded file.

v2.0.2 : TabRescue

Options

In the Script Management window, select TabRescue and click the Edit button.

log level: Logging level to display.
max tabs per Lister: Maximum number of closed tabs to remember per Lister.
show warning for non existent paths: Show a warning when trying to open non existent paths.
delayed tab closing detection: Use a workaround to avoid capturing tabs closed non-manually. Disable it if you usually close tabs very quickly and notice the script doesn't detect that action.

As for the key qualifiers, you can set how to reopen a closed tab in the 'Go Qualifiers' section:

none: Specifies how a closed tab is reopened when no key qualifier is held down.
alt: Specifies how a closed tab is reopened when the Alt key is held down.
shift: Specifies how a closed tab is reopened when the Shift key is held down.
ctrl: Specifies how a closed tab is reopened when the Ctrl key is held down.
alt+ctrl: Specifies how a closed tab is reopened when the Alt + Ctrl keys are held down.
alt+shift: Specifies how a closed tab is reopened when the Alt + Shift keys are held down.
ctrl+shift: Specifies how a closed tab is reopened when the Ctrl + Shift keys are held down.

Usage

You can show a list of recently closed tabs in that Lister, by using TabRescue LIST.
Once opened, the dialog will automatically "follow" the active Lister, so only one command window can be shown at a time.
The dialog also monitors closed tabs and updates its state in real time.
It includes a few buttons that let you quickly access common actions, as shown in the image below:

Use Ctrl+K to toggle "Keep dialog open" button state.
Use Ctrl+L to toggle "Remove invalid paths" button state.
Use Ctrl+P to toggle pause state for the active Lister.
Use Ctrl+R to toggle "Remove after reopen" button state.

The dialog allows quick filtering by tab name or path, and you can easily clear the list.
Use Up/Down to navigate the list.
Use Enter to open the selected item—the way the tab reopens depends on the modifier keys you use and their configuration.
Use F3 to focus the filter.
Use Esc to close the command dialog.
Use numbers from 0 to 9 to directly refer to an entry. Modifier keys apply as well. That is, pressing Ctrl+0 will open the path numbered as "0" , using the action defined for the "Ctrl" modifier.

TabRescue also supports the following arguments:

Command Arguments

Argument Type Value Description
LIST /O Shows a list of recently closed tabs, from which you can reopen them.
checkifexist Discards nonexistent paths when displaying the list.
LAST /S Quickly reopen the latest closed tab in the Lister.
PAUSE /S Pause the command, so it won't register any new closed tab.
UNPAUSE /S Unpause the command.
TOGGLEPAUSE /S Toggles the command's pause state.
CLEAR /S Clear closed tabs list for the Lister.

The command also exposes a Lister variable (TabRescue_count) that lets you know how many closed tabs are currently saved, which is useful when creating buttons and defining their state.

For example, you could include this at the start of a button to disable it when no closed tabs exist in the Lister, since it wouldn't make sense to show the command's list.

@evalalways:closed_tabs=IsSet("$lst:TabRescue_count") ? Val("$lst:TabRescue_count"):0;
@disableif:=closed_tabs==0
TabRescue LIST

You can then use the variable "closed_tabs" in the button's description :
=return "Closed Tabs:" + closed_tabs;

TabRescue.dcf (508 Bytes)

Notes / Technical Details

  • Note that the pause state is set per Lister, rather than globally.

  • You can open only one dialog at a time, since the dialog can handle several Listers simultaneously.

  • Numeric references are disabled when the filter has focus and re-enabled when it loses.

  • The dialog will attempt to display the corresponding icons for the path when possible. This only includes “local” or “shell” paths, as well as some paths with known icons. To avoid delays, it won't try to fetch icons for remote paths. In all other cases, it will show generic icons.

  • Icons may display incorrectly if they've been modified in the system in a non‑standard way.

  • The command implements a workaround to avoid capturing tabs closed non‑manually (e.g., by using a command that manipulates tabs or loading a Tab Group), using a 100 ms timer. This can be disabled in the script configuration (delayed tab closing detection).

  • Maximum number of remembered tabs per Lister is capped at 50 to avoid potential problems from saving very large variables.

Changelog

v2.0.2 (28-May-2025): TabRescue.opusscriptinstall (9.4 KB)

  • Fixed filtering of invalid Collections/Libraries when required.
  • Fixed certain scenarios where the dialog could appear off-screen.

v2.0.1 (26-May-2025): TabRescue.opusscriptinstall (9.4 KB)

  • The dialog has been completely restructured and the code updated.
  • The dialog can now handle multiple Listers simultaneously and fully automatically.
  • Real‑time dialog updates.
  • Buttons have been added as switches in the dialog for some common actions.
  • The dialog displays icons for the vast majority of paths.
  • Other fixes.
Complete changelog

v1.1.1 (17-May-2025):

  • Hotfix for shell path types being recognized as nonexistent.

v1.1 (16-May-2025):

  • Now the command will position its window more appropriately in case it would otherwise appear off-screen.
  • You can now reference a numbered entry by using the corresponding number key (0 to 9). Modifier keys also apply in this context.
  • Added some basic protection when trying to open invalid paths.

v1.0 (15-May-2025):

  • Initial release.
13 Likes

Hi,

I've just had a brief play with your new script. At the moment, the TabRescue dialog box opens beside the button on the toolbar, which means I have to drag the box up as I keep my script buttons etc at the bottom of the lister window. It would be better for it to open in the centre of the active DOpus window.

1 Like

I installed this today and have used it for a couple of hours.
It is very well thought out and so far works perfectly.

I added the closed_tabs count to my button label.
I also included the key qualifiers in the button info tip description using \n for new lines.

Thankyou !

@Rebel154 I’m at work right now, but when I get home I’ll update the script to avoid that. Thanks for the feedback!

Hi, I installed this script and it works fine. What do I need to change to open a closed tab in a new one? Thanks.

In a new Lister? Or a new tab?
You can tweak that in the Script Config (use Prefs SCRIPTS=TabRescue.js* to quickly go there) —just change the "none" value to "New Lister" or "New Tab"

Is it possible to open links in new tabs by middle-clicking multiple times without closing the TabRescue window?
And is it possible with multi-selection or box selection to open selected multiple items in new tabs via the right-click menu or Enter key?

Not currently.

because
  1. There is no recognizable event for middle clicking in a dialog.
  2. If the dialog won't close when a tab is reopened, should it remain open until the user closes it? And what would happen if the dialog is open and a tab is closed? Should the dialog auto update its content?
  3. I imagine that multiple selection and reopening could be implemented eventually. Although the command itself is quite old and has only been updated slightly before publication. I will consider adding it if there are more similar requests.

Thanks, perfect

v1.1 (16-May-2025):

  • Now the command will position its window more appropriately in case it would otherwise appear off-screen.
  • You can now reference a numbered entry by using the corresponding number key (0 to 9). Modifier keys also apply in this context.
  • Added some basic protection when trying to open invalid paths.
2 Likes

This version cannot open "This PC".

Thanks. Try v1.1.1. It seems that all path types recognized as ‘shell’ are being seen as nonexistent.

2 Likes

Hi, one question: Can I change the tab opening event in the menu that pops up with a single click instead of a double click? Thanks.

Feature Request: don't trigger a status bar error message, when no tabs are present to re-open yet. TabResue could rather do nothing instead.

No but you can use Enter or the corresponding numeric key if any.

All you really need is as posted above.

@eval:closed_tabs=IsSet("$lst:TabRescue_count") ? Val("$lst:TabRescue_count"):0;
@disableif:=closed_tabs==0
TabRescue LIST

This also lets us use the closed tabs count in the button label.

@eval:closed_tabs=IsSet("$lst:TabRescue_count") ? Val("$lst:TabRescue_count"):0;
@disableif:=closed_tabs==0
@label:closed_tabs
TabRescue LIST

Thanks, i didn't read that part. But i can't use the script anyway, i think there might be a bug. How am i supposed to re-open a tab? The description here doesn't even mention it. If i double click on it, it overwrites the same tab. I start with five tabs, close two, but can't re-open both of them. Only one tab appears and will be replaced, when i to open the other one as well. Also, i expect the count of closed tabs to change accordingly, and the reopened tab to be cleared from the list for clarity, but that's not the case. I will deactivate the script now, as it doesn't work for me. :anguished_face:

It does what it says it does.
It has been posted for less than a week now.

It already does not work for you ?
Well, sleep on it . Tomorrow may be a better day.

Good Night !

It has worked very well for me, just details that I wish had a different function but they are minor details, the main purpose works without problems.

No offense, it just doesn't work as expected for me. Maybe due to my locked tabs. As i said, it re-opens tabs, but uses the same, and the count doesn't go down. I also have a couple of linked tabs, so maybe those situations aren't considered yet? I know errante is writing awesome scripts, so i guess that it just doesn't suit my setup, as i have it at the moment. Also, i don't close tabs that much (except for using a couple of tab groups), but like to play around with scripts and features. Thanks!