Quantcast
Channel: Total Commander
Viewing all articles
Browse latest Browse all 3926

TC suggestions (English) • Re: order of list for recently closed tabs

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

Code:

#NoTrayIcon#KeyHistory, 0ListLines, OffSetBatchLines,-1IniRead, LNG, %COMMANDER_INI%, Configuration, LanguageIniIf LNG = ERROR   Item = Recently closed tabsElse {   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,, AWinWait, ahk_class #32768WinGet, hwnd, ID, ahk_class #32768SendMessage, 0x1E1,,,, ahk_id %hwnd%Count := DllCall("GetMenuItemCount", Ptr, hMenu := ErrorLevel) - 14Loop, % 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%      SendInput {Enter 2}      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.

Statistics: Posted by Fla$her — 2024-03-09, 03:09 UTC



Viewing all articles
Browse latest Browse all 3926