order of list for recently closed tabs

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
igarny
Junior Member
Junior Member
Posts: 58
Joined: 2023-01-26, 19:01 UTC

order of list for recently closed tabs

Post by *igarny »

Hello guys,

I am looking for a way to restore the last closed tab through a shortcut key.
The main challenge is that TC orders these in a way (top down, but from the middle) which makes it difficult to impossible to script.

It would be much more easier if the last closed panel was placed at the very bottom of the Recently closed tab list.

Perhaps there is a solution through TCFS?

Thank you very much for the great work
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

You can bind em_SaveCurTabs&CloseActiveTab (em_SaveTabs,cm_CloseCurrentTab) to Ctrl+W, where em_SaveTabs = SAVETABS2L "%COMMANDER_PATH%\Tabs\Last.tab",
and then use the recovery command em_RestoreTabs = OPENTABSL "%COMMANDER_PATH%\Tabs\Last.tab" (Ctrl+Shift+T or Ctrl+Alt+Z, for example).
Overquoting is evil! ๐Ÿ‘Ž
igarny
Junior Member
Junior Member
Posts: 58
Joined: 2023-01-26, 19:01 UTC

Re: order of list for recently closed tabs

Post by *igarny »

2Fla$her
Thank you for this suggestion. Indeed it is an interesting solution, which destroys all tabs and recreate them from a file. But there is an inconvenient side effect of it. These actions would refresh all of the tabs, which includes some remote folder locations.

I was hoping to be able to do something like:
send keys CS+A (? what is the internal command here)
send keys UP
send keys Enter

For this to work though, TC would have to sort the list of the closed tabs from the bottom to the top and not as it is now (from the "middle" to the bottom )

Hence it is a suggestion for a feature
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

igarny wrote: โ†‘2024-03-01, 05:28 UTC I was hoping to be able to do something like:
send keys CS+A (? what is the internal command here)
send keys UP
send keys Enter
TCFS2.exe /ef tcm(5515,1) send({Up}) send({Enter})

But unlike the previous solution, there is a dependence on the focus of the desired panel.
igarny wrote: โ†‘2024-03-01, 05:28 UTC and not as it is now (from the "middle" to the bottom )
Why from the middle? I don't observe this.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: order of list for recently closed tabs

Post by *petermad »

2igarny

Immediately after closing a tab you can reopen it with the combined command: cm_OpenNewTab,cm_GotoPreviousDir
But it will ONLY work if you have NOT done any navigating after you closed the tab - so it is an instant "oops"-command.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

But it will ONLY work if you have NOT done any navigating after you closed the tab - so it is an instant "oops"-command.
If the tab is locked with the ability of folder changing, then this will not work if the linked folder was changed.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: order of list for recently closed tabs

Post by *petermad »

If the tab is locked with the ability of folder changing, then this will not work if the linked folder was changed.
Neither will using the "Recently closed tabs" entry in the Folder Tab list (Ctrl+Shift+A) - it will also open the last opened folder in the tab, not the locked folder.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

not the locked folder.
I think it's an omission of the author that he doesn't save the full tab state until it's closed.

2igarny
AHK doesn't allow to control THistoryForm/TOwnerdrawPanel via ControlFocus/WinMenuSelectItem, so I don't see a scripting solution yet.
But there is one effective idea:
  1. In <wcmd_xyz.lng> on line 2063="..." insert & before any space.
  2. Update the language (this can be done from the command line): OPENLANGUAGEFILE <wcmd_xyz.lng>
  3. Use the hotkey (without Alt/Ctrl) with em_command: TCFS2.exe /ef tcm(3009,1) send(` {ENTER}`)
I support the suggestion.
Overquoting is evil! ๐Ÿ‘Ž
igarny
Junior Member
Junior Member
Posts: 58
Joined: 2023-01-26, 19:01 UTC

Re: order of list for recently closed tabs

Post by *igarny »

2Fla$her

Unfortunately for me I have no line having "2063" in the "wcmd_ext_eng.lng" file.
It is the only *.lng file I have there.

Please share your line?
My *lng* file is custom from a previous Russian compilation, so it might be the case, that is not being updated after TC upgrades.


P.S.
in response to this: viewtopic.php?p=451345#p451345
and for the record only (as I can see Fla$her supported the request later)

My statement about the list is "from the middle", because if one closes 2 or more tabs, then these are sorted in the Tabs list in the order top-down under the item "Recently closed tabs", which makes it difficult to automate for recovery
Meaning after closing several tabs, the last closed tab is not the one at the bottom of the list, but higher.
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

2igarny
You need to replace the old LNG file with last tcmdโ„–x<32/64/32_64>.exe\INSTALL.CAB\LANGUAGE\WCMD_???.LNG.
Apparently, when updating the version, you neglect this important update.
igarny wrote: โ†‘2024-03-03, 21:22 UTC Meaning after closing several tabs, the last closed tab is not the one at the bottom of the list, but higher.
This is understandable, so I ended up choosing the submenu in cm_DirTabsShowMenu instead of the item in cm_SrcTabsList.
Shifting the focus to submenu immediately shifts the focus to the first item with the last closed tab.
Overquoting is evil! ๐Ÿ‘Ž
igarny
Junior Member
Junior Member
Posts: 58
Joined: 2023-01-26, 19:01 UTC

Re: order of list for recently closed tabs

Post by *igarny »

2Fla$her

Thank you for your expert guidance. Indeed I am missing this item in the LNG file, BUT
Unfortunately from this file (https://totalcommander.ch/1103/tcmd1103x64.exe) I am not able to find the respective English version of the LNG file. I found only a MNU file
I found many other languages and thus can confirm the discrepancy between my config and expected one

I'll dig in further.
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

2igarny
There is no English LNG in the installer, because this language is built into the program, but you can take wcmd_*_eng.lng from any archive from here.
Only in it, the front ampersand will have to be moved to a space. There can only be one ampersand.
Although in the case of English, the entire contents of the file may be like this:

Code: Select all

English
2063="Recently& closed tabs"
which will result in this single change.
Last edited by Fla$her on 2024-03-04, 13:27 UTC, edited 1 time in total.
Overquoting is evil! ๐Ÿ‘Ž
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: order of list for recently closed tabs

Post by *sa16 »

2igarny
Unfortunately for me I have no line having "2063" in the "wcmd_ext_eng.lng" file.
Until you find the file you want, add the line to the old file:
2063="Recently& closed tabs"
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: order of list for recently closed tabs

Post by *petermad »

The English language files are also available here: https://plugins.ghisler.com/languages/wcmd_eng.zip
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: order of list for recently closed tabs

Post by *Fla$her »

2igarny
I did some thinking with AHK. Here's what came out:
RestoreLastClosedTab.ahk

Code: Select all

#NoTrayIcon
#KeyHistory, 0
ListLines, Off
SetBatchLines,-1

IniRead, LNG, %COMMANDER_INI%, Configuration, LanguageIni
If LNG = ERROR
   Item = Recently closed tabs
Else {
   If InStr(LNG, "\") = 0
      LNG = %COMMANDER_PATH%\Language\%LNG%
   FileReadLine, CP, %LNG%, 2
   If InStr(CP, "codepage=",0, 1) = 1
      FileEncoding, % "CP" . SubStr(CP, 10)
   FileReadLine, Item, %LNG%, 965
   If StrSplit(Item, "=")[1] = 2063
      Item = % StrSplit(Item, """")[2]
   Else {
      FileRead, Item, %LNG%
      RegExMatch(Item, "\n2063=""\K[^""]+", Item)
   }
}

PostMessage, 1075, 3009, 0,, A
WinWait, ahk_class #32768
WinGet, hwnd, ID, ahk_class #32768
SendMessage, 0x1E1,,,, ahk_id %hwnd%
Count := DllCall("GetMenuItemCount", Ptr, hMenu := ErrorLevel) - 14
Loop, % Count
{  Idx := A_Index + 14
   iNums++ := DllCall("GetMenuString", Ptr, hMenu, UInt, Idx, Ptr, 0, Int, 0, UInt, 0x400)
   VarSetCapacity(vItem, iNums << !!A_IsUnicode)
   DllCall("GetMenuString", Uint, hMenu, int, Idx, Str, vItem, Int, iNums, Uint, 0x400)
   If (vItem = Item)
   {  SendMessage, 0x1E5, Idx,,, ahk_id %hwnd%
      Loop, 2
         ControlSend, , {Enter}, ahk_id %hwnd%
      break
   }
}
If (Idx = Count + 14)
   WinClose, ahk_id %hwnd%
LNG doesn't need to be edited. But the file, of course, must be up-to-date.
There are no problems with modifiers (except Ctrl+Shift+) either. I chose Ctrl+Alt+Z (as in Gecko browsers), conveniently.
Overquoting is evil! ๐Ÿ‘Ž
Post Reply