TabRescue : Quickly restore your closed tabs

My guess is that you need to re-read the qualifiers part in the main post.

Do you really want a path to be removed from the list and the counter to go down when it reopens? It's doable to implement, but I don't see how usefulness could be improved with that, tbh. Those of you using the script, leave me your opinions below.

FWIW, that script was a bit old, and I've updated it in a version I haven't released yet (as I was waiting for a response about showing system icons, hopefully this will be possible in a new Opus beta). This new version has real-time updates and the ability to open multiple paths without closing the dialog.

Well, yeah, i thought i close one tab, which gives me that count, and if i reopen it, it's done (thus removed), except i want to open that exact tab once more, sometime later. Depending on the usecase both could make sense.

Another thing, i often change tab groups, and that will increase the closed tab count a lot, so i'll end up with two figure numbers easily. Maybe changing tab groups should be disregarded for this reason (only "imo"). Anyway, i keep the script in Opus, and also will follow the updates. I believe in the swiss knife powers of Opus and the scripting thing. :+1:

A bit technical, but AFAIK there's no way to detect whether a tab was closed because you’re loading a Tabs Group or because you manually closed it. You can try changing how you load the group (using the NOSCRIPT flag, although I’m not sure it works). I noticed the same issue, so what I do is “pause” the script whenever I’m about to load a group, then unpause it afterward. But if that’s too much hassle, you could file a feature request with Jon/Leo to add a way to differentiate them via scripting.
The only other thing I could do is add a timer to auto-pause the script for a few moments to log tab closings so only the most recently closed tab is remembered. Of course, that would also be affected if you manually close tabs quickly. :grinning_face:

On the other hand i only use tab groups in certain situations, so it's not a big deal. But yes, maybe i will ask them if there's a way to handle this special situation.

So last night I was updating the script for modern times, and the more I added, the more needed features appeared :smiley:

New features/changes:

  • Real-time updates. If a tab closes while the dialog is open, the dialog will reflect that change immediately.
  • New options available from the dialog (as buttons, in the lower right corner, from left to right): Toggle pause, remove paths after reopening, remove invalid paths, keep dialog open. All act as toggles and respond in real time to external changes when necessary (e.g., if pause state is changed outside the dialog).
  • The dialog now follows the active Lister! This is truly useful since you only need one window to manage multiple Listers.
  • Fixed the issue with "shell" path types being counted as invalid when using LIST=checkifexist.
  • Maximum number of remembered tabs is capped at 50 to avoid potential problems from saving very large variables.
  • Added a workaround to avoid capturing tabs closed non-manually (e.g., as a side effect of a command that closes multiple tabs at once). By default, there's a small delay (100 ms) after a tab closes before it's registered. This delay can be disabled in the script configuration under delayed tab closing detection.
  • Script Config now has an option to suppress the invalid-path warning.
  • Now, by default—if no modifier keys are used—the path opens in a new tab, since the previous value seemed to confuse some users. You don't need to reconfigure this if you've already changed it.
  • The script now cleans up after itself when uninstalled (I forgot that this possibility existed).
  • Other minor tweaks.

TabRescue.opusscriptinstall (8.0 KB)

Please report any bugs here or via private message.

Note: I reuploaded the script because something was off. If you’ve already downloaded it, please download it again. Sorry!

A video that might better showcase all the features. You can see real-time Lister changes/updates, tab closing detection, and some toggles in action.

5 Likes

There seems to be a problem with clearing the list in this version.
This is the button code I am using.

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

This gives me a count of closed tabs in the label.
When the count is zero, the button is disabled and the default label of 0 is displayed.

When I clear the list, the button should become disabled and the label should be 0 .
This doesn't seem to be working in this version, but it did work in the previous versions.
After clearing the list, pressing the button again results in an error even though the button should be disabled.

 2025-05-22 9:35:00 AM TabRescue:  INFO    => ===== TabRescue v2.0b1 =====
 2025-05-22 9:35:00 AM TabRescue:  DEBUG   => TabRescue LIST
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => check invalid : false
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => keep status   : false
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => remove status : false
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => Loading closed tabs list for 788440
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => Max tabs      : 15
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => Saved tabs    : 1
 2025-05-22 9:35:01 AM TabRescue:  DEBUG   => event=selchange ; name=listview ; data=0 ; value=HP48 Libraries ; index=0
 2025-05-22 9:35:09 AM TabRescue:  DEBUG   => event=focus ; name=filter ; data=false ; value= ; index=-1
 2025-05-22 9:35:10 AM TabRescue:  DEBUG   => event=click ; name=clear_btn ; data=0 ; value=link ; index=-1
 2025-05-22 9:35:10 AM TabRescue:  INFO    => ===== COMMAND FINISHED =====
 2025-05-22 9:41:17 AM TabRescue:  INFO    => ===== TabRescue v2.0b1 =====
 2025-05-22 9:41:17 AM TabRescue:  DEBUG   => TabRescue LIST
 2025-05-22 9:41:17 AM TabRescue:  ERROR   => No saved tabs for this lister yet!
 2025-05-22 9:41:17 AM TabRescue:  INFO    => ===== COMMAND FINISHED =====

Try adding @toggle:update to the end of the button which clears the list.

Thanks,
I tried that but the error persists.

That variable is written after the dialog is closed, as far as I remember. Previously, clearing the list would close the dialog. Now, there are several options that can keep the dialog open after the clearing.

I guess I can change that.

Looking more closely at your log, it seems that the dialog was no longer open at that time, but for some reason that variable isn't updating. I'll keep an eye on that later. Thanks for the log and the feedback!

Ok. I was reviewing this and it seems like a real slippery slope.

@David forget about the dialog entirely for a moment and try this:

  1. Open a tab with a path you know isn't in TabRescue's list for that Lister.
  2. Close the tab — you'll notice the counter doesn't change.
  3. Now try editing your button, but don't change anything — just open and close the edit dialog.
  4. You should now see the counter update correctly.

It looks like the way I handle Lister variables isn't playing well with the Evaluator, and it's not able to update its data automatically.

And since making a proper bug report about this (if it is a bug) would mean isolating the issue in a smaller reproducible example, etc, for now all I can do is to drop the workaround that avoids capturing tabs closed non-manually (in here is inevitable), as well as make some changes where I was doing something similar (like clearing the list). Is that or just drop support for the counter var :slightly_smiling_face:. Sorry for the inconvenience!

Maybe I'll upload an update later with a version where the counter works properly for the Evaluator, though that'll mean losing the ability to avoid capturing non-manually closed tabs and a few other things.

I had thought the counter was working when closing a tab not in the list.

But I'm only working from memory as I'm not near a computer at this time. I'm at a High School Baseball game. I'm the visiting team school bus driver.

I'll go through all of the steps you listed later and make a video if mine differs from that .

TabRescue.opusscriptinstall (8.0 KB)

Please test this one. The TabRescue_counter variable should now work correctly in all scenarios.

I learned something today — definitely a good reminder to re-read the Opus manual every now and then. :slightly_smiling_face:

You could also change your button to something like that:

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

And in the button's description : =return "Closed Tabs:" + closed_tabs;

Thanks for the feedback! It's greatly appreciated!

3 Likes

Version 2.0b2 is working perfectly ( so far ) . :grin:

Thanks for your efforts and attention to detail ! It's greatly appreciated !

Is there a way to reopen a tab in the original file display (left or right)? So it would be open on the left side, when it was closed there, even if the active side is on the right now.

Thanks!
Please try this version, I've added some workarounds to show the correct icon for at least some paths. It won't work in 100% of cases, but IMHO it's better than nothing!

You'll need at least v13.15.2 (for support for coll icons).

TabRescue.opusscriptinstall (9.3 KB)

2 Likes

Yes, this is a nice improvement !
Icons changed from the Windows properties dialog seem to be displayed properly.

I see two cases that don't work .
They still look OK though as the default windows folder icon is displayed.
Yes, it is better than nothing !

  1. Zip files can be a folder tab. Tab Rescue displays the default Windows folder icon for these.

  2. Filter Label icons . I have a filter label for empty folders.
    The icon I am using is number 166 in /system/imageres.dll

Good catch! I'll add support for that. Sure.

This one... not so much. Sorry.

Tab Rescue also can reopen FTP connections.
The icon of the tab isn't the same in the Tab Rescue list, but that's OK.
I'm happy it works !

v2.0.1 (26-May-2025):

  • 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.
4 Likes

This is cool.
I would love for stuff like this to be an integrated toggable dock, like the metadata pane.
I could open/close it with a button.