I was wondering if there is a way to automatically close tabs that have invalid paths?
I work with virtual images, once the images are unmounted, TC ends up with many open tabs that have invalid paths.
So I have to manually close them which kind of counterproductive.
You could be sitting, working with TC, and suddenly 'puff' one or more tabs disappears - at random. - And what about, if the targets of the closed tabs came back online? Should they reopen?
A better idea might actually be a detection system, that measures the validity of each tab, say, every 30 second, which changes the color to red for invalid tabs, and back to a normal color, when / or if / a tab becomes valid - AND of course with switches to set the time, and also turn the detection on and off.
I am not a programmer, but I think this would be possible.
-Keep on makin' music!
I disagree. If done right, it would not annoy anyone.
There are many keys in wincmd.ini that give users sometimes 2 or 3 even 4 options for a certain behavior of TC.
For me personally, If implemented through a new value in wincmd.ini as an option, it would satisfy everyone.
I mean the easiest things to do, would be to make a new shortcut to close all invalid tabs, just like there is one now for closing all tabs or closing duplicate tabs.
And what is the problem with that? You unmounted virtual drives, tabs should close after paths become invalid. If you want to recycle the tabs in case of network drives, lock them.You could be sitting, working with TC, and suddenly 'puff' one or more tabs disappears - at random.
There are many - and I mean MANY - reasons why a path can become invalid, not all of which mean that they're actually invalid. Sometimes it can mean that the target becomes valid again after a short period of time, sometimes it's even on purpose!
I suggest to implement a new cm_ command that takes care of invalid tabs on user request. This may even be added to the tab context menu so it's readily available. IMO this is the only good way to do it, automatic closing of tabs is just prone to user troubles and bug reports, timer-controlled is better but still not good enough. That's all IMO, but one thing I know for sure: an application should never ever automatically close anything on its own!
Real examples would be nice. Also to satisfy everyone, I propose a new key for wincmd.ini
Also what do you do when you click on a tab that has an invalid path, I mean the tabs you keep for in case they will become valid again?
I seem to recall this un-helpful behavior of closing Explorer windows started win Windows XP.
Running Total Commander v8.52a
I believe this behavior is only true for a recycled tab not newly created tabs. Also, the last invalid active tab will be redirected to C:, not all invalid tabs. Mount 3 images at the same time and open 3 tabs, pointing to the path, then unmount all images.
How so? If you click on that tab with invalid path locked or not, TC will produce an error window asking you to chose another disk.A locked tab remains locked pointing to the CD drive
Had thought about adding some examples initially. Here we go:
- Removal of a virtual drive, like in your use case
- Removal of a physical drive, e.g. external USB flash drive, HDD or something like that
- Loss of network connection, so a mapped network drive or even UNC path becomes (temporarily) invalid
- Removal of a substituted path, e.g.:
Code: Select all
subst Z: /d
- Changing NTFS permissions so a directory refresh could fail because access may be denied after that. This is also a case where the path may become valid again (after reverting the permission change).
- Changing/Removing a mount point or drive letter in Windows Disk Management (or mountvol or diskpart)
- Unloading a file-system plugin, maybe even removing the plugin while TC is running, only in the latter case it would make sense to close such a tab - but maybe not, because it could be on purpose to update a plugin. However, the TC file-system plugins provide a wide variety of potentially invalid path situations!
- Loss of VPN or SSH tunnel connection so that specific (network) resources are not available
Usually when I know that a path is going to become invalid I let it do so, in which case TC switches to the system drive automatically. The difference is that the tab is reusable, maybe for the next virtual drive I'll mount after a short period of time.Also what do you do when you click on a tab that has an invalid path, I mean the tabs you keep for in case they will become valid again?
Your reasoning is clear. Just keep in mind that I am not proposing closing of all invalid tabs automatically as a default behavior, I am simply suggesting a key that gives you option to do so.
If the tab is active while the path becomes invalid then it will be redirected to system drive. If you open bunch of tabs and the path becomes invalid in all of them, only the active tab will be redirected to system drive.Usually when I know that a path is going to become invalid I let it do so, in which case TC switches to the system drive automatically. The difference is that the tab is reusable, maybe for the next virtual drive I'll mount after a short period of time.
Yes, I understand that. But I suggest to implement it in a way that works on user request instead, like in the tab context menu, e.g. an item "Close all tabs with invalid paths now", and/or as cm_ command, e.g. cm_CloseInvalidTabs or something along those lines. Such an approach is much less prone to users complaining about "vanishing tabs" or similar "bug reports". This might even occur when users set that option in wincmd.ini and forget about it, like is the case with other wincmd.ini options like CopyLinks and such. Sometimes another wincmd.ini option is just the wrong place, and IMO it is in this case.
True, but I reuse them or close them depending on the situation, depending on what I want to do next. Another reason why I think automatic closing is not a good suggestion which would be able to cover all possible use cases.If you open bunch of tabs and the path becomes invalid in all of them, only the active tab will be redirected to system drive.
I've been reading all the answers in this thread thoroughly.
And I (still) totally agree, that removing anything(!) automatically: tabs in TC, funds from your bank account, bodily abilities due to old age (sh**! that actually happens) - It is a very BAD idea. ...very!
BUT.. I still think the solution i mentioned above, about a detection system, that measures the validity of each tab (read the second post) is a good idea. It doesn't delete any tabs and could generally be very useful and informative.
Everybody have a nice sunday.
-Keep on makin' music!