TabTools

Title TabTools
File Name TabTools.txt
Description Display list of all tabs in both panels with paths, names and status. Perform operations on tabs
Author Vochomurka
Parameters -
Plugins Called win, ini, tc, childwin, miscplugin, file, vec
Icon
Version 5.4
Updated on 26.02.2011
Called Scripts ReadTabs, ParsePath, TMTC, CloseAllTabs
static hwnd = win.handle("c=TTOTAL_CMD")
global Config = "path/wincmd.ini"
global TT = cl.Create("Tabs", 1)
;subdirectory "TabTools" of the "scripts" folder is created by user.
;This directory contains files TabTools.txt, TT.icl and TabTools.ini
global TW = pprofolder ++ "scripts/TabTools/TabTools.ini"
static Icons = pprofolder ++ "scripts/TabTools/TT.icl"
static Quote = esc(?+\"+, ?+\+)
static OpQuote = esc(?+\d171+, ?+\+)
static ClQuote = esc(?+\d187+, ?+\+)
static CR = esc(?+\n+, ?+\+)
static Slash = esc(?+\\+, ?+\+)
static NoMess

local LTabs, RTabs, Temp, Number, Stat, Comm, FS, BS, MaxText, i

win.sendmessage(hwnd, 0x400+51, 580, 0)

if(ini.check_exists(TW, "Configuration", "NoMessage") == 3) do
	Temp = ini.get(TW, "Configuration", "NoMessage")
	NoMess = case("lower", Temp)
endif

if(ini.check_exists(TW, "FontColor", "Source") == 3)
	FS = ini.get(TW, "FontColor", "Source")

if(ini.check_exists(TW, "BackColor", "Source") == 3)
	BS = ini.get(TW, "BackColor", "Source")

Comm = ini.get(TW, "Configuration", "Labels")

;Sub_ReadTabs - name of script ReadTabs 
LTabs = runfile.Subs\Sub_ReadTabs("left")
RTabs = runfile.Subs\Sub_ReadTabs("right")

if(max(Ltabs, RTabs) > ini.get(TW, "Configuration", "MaxTabs"))
	TT.AddProperties("Format=IconSize: 16")

Number = TT.Length
MaxText = ini.get(TW, "Configuration", "MaxText")

for(i = 0; i < Number; i++)
	Temp = TT.GetMiddleCmd(i)
	if(Temp == 1 && tc.active(hwnd) == "left" && TT.GetLeftOnTop(i)) do
		TT.SetTextColor(i, FS)
		TT.SetBackColor(i, BS)
	endif

	if(Temp == 2 && tc.active(hwnd) == "right" && TT.GetLeftOnTop(i)) do
		TT.SetTextColor(i, FS)
		TT.SetBackColor(i, BS)
	endif

	Stat = TT.GetLeftCmd(i)
	TT.ClearRight(i)
;TabTools - name of script TabTools (recursive call)	
	TT.AddRight(i, cb("TabTools/TabTools@CloseTab", Stat))
	TT.SetHeight(i, Stat)
	Stat = ifelse(Temp == 1, 5201 + Stat, 5301 + Stat)
	TT.ClearLeft(i)
	TT.AddLeft(i, "win.sendmessage(hwnd, 0x400+51, " ++ Stat ++ ", 0)")

	if(Comm == 0) do
		Temp = TT.GetToolTip(i)
	elseif(Comm == 1)
		Temp = TT.GetId(i)
	elseif(Comm == 2)
		Temp = TT.GetId(i)
		Stat = TT.GetToolTip(i)
		if(Stat)
			Stat = " = " ++ OpQuote ++ Stat ++ ClQuote

		Temp = Temp ++ Stat
	endif
	if(length(Temp) > MaxText)
		Temp = select(Temp, MaxText) ++ "..."

	TT.SetLabel(i, Temp)
	Temp = "Path: " ++ OpQuote ++ TT.GetId(i) ++ ClQuote
	if(TT.GetToolTip(i))
		Temp = Temp ++ "/Caption: " ++ OpQuote ++ TT.GetToolTip(i) ++ ClQuote

	TT.SetTooltip(i, Temp)
endfor

TT.Insert(LTabs)
TT.AddLeft(LTabs, "Format NewColumnLine")
TT.SetId(LTabs, "Vertical Separator")
TT.AddRight(LTabs, RTabs)
TT.AddMiddle(LTabs, LTabs)

if(not ini.get(TW, "Configuration", "IncludeCommands")) do
	*menu show Tabs
	quit all
endif

if(LTabs < RTabs) do
	Temp = LTabs
	Number = RTabs - LTabs
elseif(LTabs > RTabs)
	Temp = LTabs + RTabs + 1
	Number = LTabs - RTabs
elseif(LTabs == RTabs)
	Number = 0
endif

for(i = 0; i < Number; i++)
	TT.Insert(Temp + i)
	TT.SetIconVisible(Temp + i, 0)
	TT.SetEnabled(Temp + i, 0)
	TT.SetTooltip(Temp + i, "TabTools 5.3/(C) Vochomurka/2005-2009")
endfor

Temp = TT.GetIdIndex("Vertical Separator")
TT.Insert(Temp)
TT.AddLeft(Temp, "Format Separator")

Number = TT.Length
TT.Insert(Number)
TT.AddLeft(Number, "Format Separator")

Comm = 6

Temp++
TT.Insert(Temp)
TT.AddLeft(Temp, "Format EndSubMenu")

TT.Insert(Temp)
TT.AddLeft(Temp, "Format StartSubMenu")
TT.SetLabel(Temp, "Left Panel Tabs")

Number = TT.Length
TT.Insert(Number)
TT.AddLeft(Number, "Format EndSubMenu")

TT.Insert(Number)
TT.AddLeft(Number, "Format StartSubMenu")
TT.SetLabel(Number, "Right Panel Tabs")

for(i = 1; i <= 2; i++)
	Stat = i*(Temp + i) + (i - 1)*Comm

	TT.Insert(Stat)
;TabTools - name of script TabTools (recursive call)
	TT.AddLeft(Stat, cb("TabTools/TabTools@PathVal", i, 1))
	TT.AddRight(Stat, cb("TabTools/TabTools@PathVal", i, 0))
	TT.SetLabel(Stat, "Check Path &Validity")
	TT.SetIcon(Stat, Icons, 3)
	TT.SetTooltip(Stat, "Left - Check & ask to close/Right - Close silently")

	TT.Insert(Stat)
	TT.AddLeft(Stat, cb("TabTools/TabTools@CloseDups", i))
	TT.SetLabel(Stat, "Close Opposite &Dups")
	TT.SetIcon(Stat, Icons, 4)
	TT.SetTooltip(Stat, "Close duplicate tabs in opposite panel")

	TT.Insert(Stat)
	TT.AddLeft(Stat, cb("TabTools/TabTools@Alias", i))
	TT.SetLabel(Stat, "&Alias")
	TT.SetIcon(Stat, Icons, 5)
	FS = "Change tab captions according to settings in TabTools.ini, sections [Caption] & [Alias]"
	TT.SetTooltip(Stat, FS)

	TT.Insert(Stat)
	TT.AddLeft(Stat, cb("TabTools/TabTools@Highlight", i, 1))
	TT.AddRight(Stat, cb("TabTools/TabTools@Highlight", i, 0))
	TT.SetLabel(Stat, "&Highlight Tab(s)")
	TT.SetIcon(Stat, Icons, 6)
	TT.SetTooltip(Stat, "Left - highlight tab(s)/Right - clear highlighting")

	TT.Insert(Stat)
	TT.AddLeft(Stat, cb("TabTools/TabTools@CloseAllTabs", i))
	TT.SetLabel(Stat, "&Close All Tabs")
	TT.SetIcon(Stat, Icons, 7)
	TT.SetTooltip(Stat, "Close all tabs, independent of lock status")

	TT.Insert(Stat)
	TT.AddLeft(Stat, cb("TabTools/TabTools@MultiFind", i))
	TT.SetLabel(Stat, "&Find in All Tabs")
	TT.SetIcon(Stat, Icons, 8)
	TT.SetTooltip(Stat, "Open 'Find File' dialog box with 'Search in' field filled with paths of all tabs")
endfor

if(ini.get(TW, "Configuration", "SmallIcons")) do
	TT.AddProperties("Format=IconSize: 16")
 else
	TT.AddProperties("Format=IconSize: 32")
endif

TT.AddProperties("Format=tooltips")

if(ini.check_exists(TW, "Configuration", "AnyProps") == 3)
	TT.AddProperties(ini.get(TW, "Configuration", "AnyProps"))

TT.showmenu()
quit all
//******************************************************************
Function Alias(Panel)

;Sub_TMTC - name of script TMTC
local Temp = runfile.Subs\Sub_TMTC(hwnd, Panel)
if(not Temp) do
	messagebox("ok stop", "No tabs to rename", "TabTools script")
	quit all
endif

local i, j, Comm, Hand, Str, Caption
local Delim = ", "
static RH = "RightHistory"
static LH = "LeftHistory"
static C = "Caption"
static DM = "DirMenu"
static SI = "SearchIn"
static PD = "ParentDir"
flag clear 1 6

if(ini.check_exists(TW, C, "Alias") == 3) do
	if(ini.get(TW, C, "Alias"))
		flag set 1
endif

if(ini.check_exists(TW, C, SI) == 3) do
	if(ini.get(TW, C, SI))
		flag set 2
endif

if(ini.check_exists(TW, C, DM) == 3) do
	if(ini.get(TW, C, DM))
		flag set 3
endif

if(ini.check_exists(TW, C, PD) == 3)
	flag set 4

if(ini.check_exists(TW, C, LH) == 3)
	flag set 5

if(ini.check_exists(TW, C, RH) == 3)
	flag set 6

if(ini.check_exists(TW, C, "Delimiter") == 3)
	Delim = ini.get(TW, C, "Delimiter") ++ " "

if(not pproflag(1) && not pproflag(2) && not pproflag(3) && not pproflag(4) && not pproflag(5) && not pproflag(6)) do
	messagebox("ok warning", "No alias source specified", "TabTools script")
	quit all
endif

for(i = 0; i < TT.Length; i++)
	Temp = TT.GetMiddleCmd(i)
	if(Temp == Panel) do
		Temp = TT.GetId(i)
		Caption = Temp

		if(pproflag(4))
			Comm = ini.get(TW, C, PD)

;Sub_ParsePath - name of script ParsePath 
		if(pproflag(4) && miscplugin.is_int(Comm) && Comm > 0)
			Caption = runfile.Subs\Sub_ParsePath(Temp, Comm)

		if(pproflag(1) && ini.check_exists(TW, "Alias", Temp) == 3)
			Caption = ini.get(TW, "Alias", Temp)

		if(pproflag(2)) do
			Comm = ini.enum_keys(Config, SI)
			Hand = line(Comm, 0)
			for(j = 0; j < Hand; j++)
				Str = line(Comm, j)
				Str = ini.get(Config, SI, j)
				if(Str ++ Slash == Temp) do
					Caption = Caption ++ Delim ++ ini.get(TW, C, SI)
					break
				endif
			endfor
		endif

		if(pproflag(3)) do
			for(j = 1; j < 200; j++)
				Str = "menu" ++ j
				if(ini.check_exists(Config, DM, Str) != 3)
					break

				Str = "cmd" ++ j
				if(ini.check_exists(Config, DM, Str) == 3) do
					Hand = ini.get(Config, DM, Str)
					if(index(Hand, "cd ") == 1) do
						Hand = remove(Hand, 3)
						if(Hand ++ Slash == Temp) do
							Temp = ini.get(TW, C, DM)
							Caption = Caption ++ Delim ++ Temp
						endif
					endif
				endif
			endfor
		endif

		if(pproflag(5)) do
			Comm = ini.enum_keys(Config, LH)
			Hand = line(Comm, 0)
			for(j = 0; j < Hand; j++)
				if(ini.get(Config, LH, j) == Temp) do
					Caption = Caption ++ Delim ++ ini.get(TW, C, LH)
					break
				endif
			endfor
		endif

		if(pproflag(6)) do
			Comm = ini.enum_keys(Config, RH)
			Hand = line(Comm, 0)
			for(j = 0; j < Hand; j++)
				if(ini.get(Config, RH, j) == Temp) do
					Caption = Caption ++ Delim ++ ini.get(TW, C, RH)
					break
				endif
			endfor
		endif
		TT.RunLeft(i)
		win.postmessage(hwnd, 0x400+51, 3009, 0)
		*keys {down 2}{enter}
		wait.for(activewindow("c=TCheckEditBox"))
		Hand = win.getfocus()
		win.settext(Hand, Caption)
		*keys {enter}
	endif
endfor

if(not index(NoMess, "a"))
	messagebox("ok information", "Aliasing complete", "TabTools script")

quit	//'Alias' function
//******************************************************************
Function CloseAllTabs(Panel)
local Cur = ifelse(tc.active(hwnd) == "left", 4001, 4002)
local Focus = 4000 + Panel
win.sendmessage(hwnd, 0x400+51, Focus, 0)
;CloseAllTabs - name of script CloseAllTabs 
runfile.CloseAllTabs
quit						//'CloseAllTabs' function
//******************************************************************
Function CloseDups(Panel)
local i, j, k, Side, Path, Temp, Opp, Comm, Number

local Counter = 0
local Mess
local Cap = "Duplicating tabs in " ++ ifelse(Panel == 2, "left", "right") ++ " panel: "

@Start

flag clear 1
Temp = TT.GetIdIndex("Vertical Separator")
Opp = ifelse(Panel == 1, TT.GetRightCmd(Temp, 1), TT.GetMiddleCmd(Temp, 1))
				
if(Opp == 1) do
	messagebox("ok stop", "There is only one tab", "Bad user command")
	quit all
endif

Number = TT.Length

for(i = 0; i < Number; i++)
	Side = TT.GetMiddleCmd(i)
	if(Panel == Side) do
		Path = TT.GetId(i)
		for(j = 0; j < Number; j++)
			Side = 	TT.GetMiddleCmd(j)
			if(Panel != Side && Side != "") do
				Temp = TT.GetId(j)
				if(Path == Temp) do
					Counter++
					if(Counter != 1)
						Mess = Mess ++ CR ++ CR

					Mess = Mess ++ "Tab #" ++ Counter ++ ":"
					Mess = Mess ++ CR ++ "Path: '" ++ Temp ++ "'"
;TabTools - name of script TabTools (recursive call)
					Mess = Mess ++ .TabTools\TabTools@CloseTab(TT.GetMiddleCmd(j), j)
					flag set 1
					break
				endif
			endif
		endfor
		if(pproflag(1))
			break

	endif
endfor

if(pproflag(1))
	jump Start

Cap = Cap ++ Counter

if(index(NoMess, "c"))
	quit

if(Mess) do
	messagebox("ok warning", Mess, Cap)
else
	messagebox("ok information", "No duplicates found", Cap)
endif

quit						//'CloseDups' function
//******************************************************************
Function Highlight(Panel, Action)

;Sub_TMTC - name of script TMTC 
local TMTC = runfile.Subs\Sub_TMTC(hwnd, Panel)
if(not TMTC) do
	messagebox("ok stop", "No tabs to highlight", "TabTools script")
	quit all
endif

local i, List, Label, Side
local Number = TT.Length
local NewLine = esc(?+\r+, ?+\+)

for(i = 0; i < Number; i++)
	if(TT.GetMiddleCmd(i) == Panel) do
		Label = TT.GetLabel(i)
		List = List ++ Label ++ NewLine
	endif
endfor

NewLine = "Pick tab(s) to " ++ ifelse(Action, "highlight", "clear highlighting")
pickstring(List, NewLine, 3)
Side = word(_pickedline_, 0)

for(i = 1; i <= Side; i++)
	Number = word(_pickedline_, i)
	win.sendmessage(TMTC, 4915, Number - 1, Action)
endfor

quit						//'HighLight' function
//******************************************************************
Function MultiFind(Num)

local i, Target, Str, Panel

for(i = 0; i < TT.Length; i++)
	Target = TT.GetId(i)
	Panel = TT.GetMiddleCmd(i)
	if(validpath(Target) && Num == Panel)
		Str = Str ++ Target ++ ";"
endfor

Str = remove(Str, -1)
win.postmessage(hwnd, 0x400+51, 501, 0)
wait.for(activewindow("c=TFindFile"))
Panel = win.handle("c=TFindFile")
Target = childwin.handle(Panel, 22)
win.settext(Target, Str)

quit						//'MultiFind' function
//******************************************************************
Function PathVal(Panel, Ask)

;Sub_TMTC - name of script TMTC
local Number = runfile.Subs\Sub_TMTC(hwnd, Panel)
if(not Number) do
	messagebox("ok stop", "No tabs to check", "TabTools script")
	quit all
endif

Number = TT.Length
local i, j, Side, Path, Beg, Mess, Counter, Section, Status
local Cap = "Invalid tabs in "
local Comm = "/Caption: "

if(Panel == 1) do
	Section = "lefttabs"
	Cap = Cap ++ "left"
else
	Section = "righttabs"
	Cap = Cap ++ "right"
endif

Cap = Cap ++ " panel"
local Active = ini.get(Config, Section, "activetab")
local Temp = (Number - 1)*3

flag clear 2 3

if(ini.check_exists(TW, "ValidPaths", "Archives") == 3 && ini.get(TW, "ValidPaths", "Archives"))
	flag set 2

if(ini.check_exists(TW, "ValidPaths") == 2)
	flag set 3

v = vec.create(Temp)
if(v <= 0) do
	messagebox("ok error", "Vector not created", "VEC plugin error")
	quit
endif

for(i = 0; i < Number; i++)
	flag clear 1
	Side = TT.GetMiddleCmd(i)
	Status = TT.GetIconNumber(i)
	if(Panel == Side) do
		Path = TT.GetId(i)

		if(not validpath(Path)) do
			if(pproflag(3)) do
				Temp = ini.enum_keys(TW, "ValidPaths")
				Side = line(Temp, 0)
				for(j = 1; j <= Side; j++)
					Beg = line(Temp, j)
					if(index(Path, Beg) == 1) do
						flag set 1
						break
					endif
				endfor
			endif

			if(pproflag(2)) do
				Temp = remove(Path, -1)
				if(not file.isfolder(Temp) && length(Temp) > 2)
					flag set 1

			endif

			if(pproflag(1))
				jump NextPath



			Temp = TT.GetHeight(i)
			if(Mess)
				Mess = Mess ++ CR ++ CR

			Mess = Mess ++ "Invalid path is '" ++ Path ++ "'" ++ CR ++ "Tab #" ++ Temp
			if(Active > Temp)
				Active--

			Side = ""
			if(Status == 1 || Status == 4)
				Side = Side ++ "locked "
			if(Status == 2 || Status == 5)
				Side = Side ++ "locked, but directory changes allowed "
			if(Side != "")
				Mess = Mess ++ CR ++ "Status: " ++ Side

		else
@NextPath
			v[Counter*3] = Path
			v[Counter*3 + 1] = TT.GetToolTip(i)
			Side = TT.GetHeight(i)
			if(Side > Active)
				Side--

			Temp = ini.get(Config, Section, Side ++ "_options")
			v[Counter*3 + 2] = Temp
			Counter++
		endif
	endif
endfor

if(not Mess) do
	if(not index(NoMess, "p"))
		messagebox("ok information", "All paths are valid", "TabTools script")

	vec.destroy(v)
	vec.unload
	quit all
endif

if(Ask) do
	Mess = Mess ++ CR ++ CR ++ "Close invalid tabs?"
	if(messagebox("yesno question", Mess, Cap) == 7) do
		vec.destroy(v)
		vec.unload
		quit all
	endif
endif

Cap = "2.tab"
Path = ini.get(Config, "Configuration", "TabDir") ++ Cap
Beg = file.open(Path, "w")
if(Beg <= 0) do
	messagebox("ok error", "File not opened", "FILE plugin error")
	quit
endif
file.writeline(Beg, "[activetabs]")

for(i = 0; i < Counter; i++)
	file.writeline(Beg, i ++ "_path=" ++ v[i*3])
	Temp = v[i*3 + 1]
	if(index(Temp, Comm)) do
		Status = index(Temp, Comm)
		Section = slice(Temp, Status + 10, length(Temp) - 2)
		file.writeline(Beg, i ++ "_caption=" ++ Section)
	endif

	file.writeline(Beg, i ++ "_options=" ++ v[i*3 + 2])
endfor

vec.destroy(v)
vec.unload

file.writeline(Beg, "activetab=" ++ Active)

file.close(Beg)
win.sendmessage(hwnd, 0x400+51, 4000 + Panel, 0)
win.postmessage(hwnd, 0x400+51, 3009, 0)
*keys {slow}{up 4}{enter}
wait.for(1500, activewindow("c=#32770"))

Side = win.handle("c=#32770")

for(not win.childhandlelist(Side, "c=Edit"))
endfor

local List = win.childhandlelist(Side, "c=Edit")
local Edit = word(List, 1)

if(not Edit || word(List, 0) > 1) do
	messagebox("ok error", "No Edit Class Window")
	quit
endif

wait.for(100)
win.settext(Edit, Path)
wait.for(100)

for(childwin.gettext(Edit) != Path)
endfor

*keys ^{enter}
quit
//******************************************************************
Function CloseTab(Number, Item)
flag clear 1

if(not miscplugin.is_int(Item)) do
	flag set 1
	Item = cl.GetLastMenuSel()
endif

local Mess, k
local Temp = TT.GetIconNumber(Item)
local Panel = TT.GetMiddleCmd(Item)
TT.RunLeft(Item)

if(Temp == 1) do
	win.sendmessage(hwnd, 0x400+51, 3010, 0)
	Mess = CR ++ "Status: locked"
elseif(Temp == 2) do
	win.sendmessage(hwnd, 0x400+51, 3012, 0)
	Mess = CR ++ "Status: locked, but directory changes allowed"
endif

win.sendmessage(hwnd, 0x400+51, 3007, 0)

TT.Remove(Item)
local Result = TT.GetIdIndex("Vertical Separator")
local Right = TT.GetRightCmd(Result, 1)
local Left = TT.GetMiddleCmd(Result, 1)

if(Panel == 2) do
	TT.ClearRight(Result)
	Right--
	TT.AddRight(Result, Right)
else
	TT.ClearMiddle(Result)
	Left--
	TT.AddMiddle(Result, Left)
endif

local What = TT.GetLabelIndex("Left Panel Tabs")

if(What) do
	Result = TT.GetLabelIndex("Right Panel Tabs")
	if(Right > Left) do
		if(Panel == 1) do
			TT.Insert(What - 1)
			TT.SetIconVisible(What - 1, 0)
		else
			TT.Remove(What - 2)
		endif
	elseif(Left > Right) do
		if(Panel == 1) do
			TT.Remove(Result - 2)
		else
			TT.Insert(Result - 1)
			TT.SetIconVisible(Result - 1, 0)
		endif
	elseif(Left == Right) do
		if(Panel == 1) do
			TT.Remove(Result - 2)
		else
			TT.Remove(What - 2)
		endif
	endif
endif

for(k = Item; k < TT.Length(); k++)
	What = TT.GetLeftCmd(k, 1)
	Code = select(What, 33, 36)
	if(miscplugin.is_int(Code)) do
		Temp = ifelse(Code < 5300, 1, 2)
		if(Panel == Temp && k >= Number) do
			What = TT.GetHeight(k)
			TT.ClearRight(k)
;TabTools - name of script TabTools (recursive call)
			TT.AddRight(k, cb("TabTools/TabTools@CloseTab", What))
			What--
			TT.SetHeight(k, What)
			Code--
			What = "win.sendmessage(hwnd, 0x400+51, " ++ Code ++ ", 0)"
			TT.ClearLeft(k)
			TT.AddLeft(k, What)
		endif
	endif
endfor

if(pproflag(1))
	TT.showmenu()

quit(Mess)

Comments:

This script for Total Commander 7.0 and older.

I consider the folder tabs one of greatest advantages of Total Commander over other file managers. Before the sixth version was released I had been often forced to run several instances of Total Commander and drag files between them. The sixth version was a real revolution! Since then at doing my everyday job I have 7-10 tabs in each of panels.

But sometimes I must work on two or three projects at once. It means that the quantity of tabs increases to 10-15, and some of them have equal names (especially such "popular" as Doc, Help, Plugins, Language, Templates, etc).

Current version of script is able to:

Look at the screenshot:

It is recommended to use the TT.icl icon library. Put it to the "TabTools" subdirectory of "scripts" folder. The same concerns the TabTools64.icl for Windows Se7en 64 bit and, perhaps, other 64 bit systems.

The script stores its settings in the ini-file. Common keys are in the [Configuration] section:

[Configuration]
SmallIcons=0
;(0|1)=(no|yes) icons always are 16õ16 pixels

IncludeCommands=1
;(0|1)=(no|yes) include command submenu

Labels=2
;(0|1|2) Labels: 0 - name, 1 - path, 2 - both

MaxTabs=20
;if the number of tabs exceeds this value, the script uses small font and icons 16õ16

MaxText=50
;if the tab path/name is longer than MaxText characters, the rest is truncated and replaced with ...

NoMessage=pca
;restrict any message from functions: "p" (PathVal), "c" (CloseDups), "a" (Alias)

AnyProps=
;any properties valid for PowerPro menus. See PowerPro documentation for details.
;For example, AnyProps=Backbmp=* sets the menu background to be the desktop wallpaper

[Alias]
c:\user\Batches\=Batches
d:\Utils\PowerPro\scripts\=Scripts
d:\Documents and Settings\Administrator\Start Menu\Programs\Startup\=Very-very long path

Functions are described in the following chapters. To know what each function is for, just wait some seconds holding the mouse over the command of interest, and the tooltip will be shown (see screenshot).

The script itself (TabTools.txt), its icon library (TT.icl), and configuration file (TabTools.ini) should be copied to the "TabTools" subdirectory of "scripts" directory. If PowerPro is installed to c:\Program Files\PowerPro, then the path of these files should be c:\Program Files\PowerPro\scripts\TabTools\.


PathVal ("Check Path Validity")

Function PathVal checks whether all tabs correspond to valid paths. For example, you open a new tab to access your CD-ROM. After ejecting the disk the tab is no longer valid, but remains available. At switching to this tab Total Commander tries to read the CD-ROM, that yields some seconds of unpleasant sounds, wear of motor, and annoying error messages. To avoid it you should first run the PathVal function that finds all tabs pointing to invalid paths, and then close them.

The only section of TabTools.ini necessary for this function is [ValidPaths]. It is not recommended to delete two existing keys, but you can add your own:

[ValidPaths]
::=
\\\=
Archives=1
any_path1=
any_path2=

Two first keys provide that paths to "Network places" and its children (including FS plugins), and to special folders like Desktop and Control Panel be considered valid. I find no sense in adding keys, but perhaps you do. In this case don't forget the = character after the path.

Key Archives=1 defines that paths inside archives are treated as valid ones.

Left mouse button click on this command allows to confirm that invalid tabs should be closed. Right button click closes them without confirmation.


CloseDups ("Close Duplicates in Opposite Panel")

Total Commander v6.50 introduced a very useful command "Close duplicate tabs" in tab header right click menu, but this command can close only active panel tabs. Function CloseDups closes tabs in the opposite panel, duplicating tabs in the current panel. No configuration key is required.


Highlight ("Highlight Tabs")

To understand what this function is for, you should first read comments for the HighlightCurrentTab script. The difference is that the Highlight function allows to highlight any number of tabs at once. For example, it is convenient to highlight tabs dealing with some selected project.

Left button click allows to highlight tabs, right click provides something opposite - clearing highlighting and get tabs to the initial state.


Alias ("Alias")

This function is useful when, first, there are too many tabs, and, second, some of them have the same name. How to cope with this problem?

First, you can rename each tab manually, but it takes much time. Second, you can point the mouse over a tab and see the tooltip with the tab path, but it is difficult to read long paths.

Instead, the Alias function has four modes to rename tabs. The following sections and keys of the configuration serve to manage these modes:

[Caption]
Alias=1
ParentDir=2
SearchIn=<s>
DirMenu=<d>
LeftHistory=<lh>
RightHistory=<rh>
Delimiter=

[Alias]
d:\Documents and Settings\Administrator\Start Menu\Programs\Startup\=Very-very long path

First mode is "Alias" that allows to give specific names to specific paths. The [Alias] section can contain any number of keys with the following format:

path\=alias

"alias" can be any text you will see in the caption of tab pointing to path. The backslash character after path matters!

To switch on/off the "Alias" mode edit the Alias key of the [Caption] section. In the example above the mode is on. To switch it off, type ; before this key or make it equal to "":

;Alias=1
or
Alias=""

In these two examples the mode is switched off.

Second mode "ParentDir" is activated by the ParentDir key. The number indicates the path depth included in the tab name. For example, if you open a tab pointing to the c:\One\Two\Three directory, the default tab name is Three. But the same name is given to the tab pointing to d:\Five\Four\Three, that is, quite another directory! After assigning the "2" value to the ParentDir key, as shown above, and running the function, the tab names would be Two\Three, and Four\Three, respectively.

To switch off this mode, as any other one, either make the key equal to "", or comment this key by typing the semicolon before it.

Third mode is "SearchIn". To understand what it is, open the "Find file" dialog and there open the "Search in" dropdown list. It contains paths for which the recent "find" command was given. So, it looks like as your favourite path list, doesn't it? By assigning any string but "" to the SearchIn key you will see this string (<s> in the example) in captions of tabs pointing to directories from this list.

The said refers to LeftHistory and RightHistory keys. These are directories recently visited in corresponding panels. Press Alt+Down or the triangle button to open "history list".

"DirMenu" is similar to the "SearchIn" mode, except that it deals with your "Directory hotlist" (called by Ctrl+D or asterisk button).

All modes are independent.

The Delimiter key corresponds to a character (or some characters) put between several aliases. Note that a space is always added after the delimiter. If nothing is specified (as above) then aliases are separated by "comma+space".


CloseAllTabs ("Close All Tabs")

I believe that the function name is self-explanatory. Tabs are closed irrespective of their lock status.


MultiFind ("Find in All Tabs")

Function prepares the "Find files" window to find files and/or text in all directories the tabs in one panel are pointing on.


Main Page Total Commander PowerPro