ViewTabFile

Title ViewTabFile
File Name ViewTabFile.txt
Description Display contents of *.tab file
Author Vochomurka
Parameters *.tab file name (without path and extension)
Plugins Called file, ini
Icon depends on file
Version 2.0
Updated on 08.06.2009
args TabFile
local TabPath = "path_to_tabs\"
if(TabFile) do
	TabFile = TabPath ++ TabFile ++ ".tab"
else
	TabFile = pickfile(file.listfiles(TabPath, 0), "Pick a tab file")
	if(!TabFile)
		quit

endif

local i, Active, Temp
local Values = file.getdate(TabFile)
local TabChar = esc(?+\t+, ?+\+)
local CR = esc(?+\n+, ?+\+)
local OpQuote = esc(?+\d171+, ?+\+)
local ClQuote = esc(?+\d187+, ?+\+)
local Active = ini.get(TabFile, "activetabs", "activetab")
local Message = "File date: " ++ formatdate("longdate", select(Values, 8)) ++ ", file time: "
Message = Message ++ formattime("HH:mm:ss", select(Values, -6)) ++ CR ++ CR
local Keys = ini.enum_keys(TabFile, "activetabs")
local Values = line(Keys, 0)

for(i = Values/3; i <= Values/2; i = i + 1)
	if(ini.check_exists(TabFile, "activetabs", i ++ "_path") != 3) do
		Temp = i - 1
		break
	endif
endfor

for(i = 0; i <= Temp; i = i + 1)
	Values = ini.get(TabFile, "activetabs", i ++ "_path")

	if(i == Active) do
		Message = Message ++ i ++ " (A):" ++ TabChar ++ Values
	else
		Message = Message ++ i ++ ":" ++ TabChar ++ Values
	endif

	if(ini.check_exists(TabFile, "activetabs", i ++ "_caption") == 3) do
		Values = ini.get(TabFile, "activetabs", i ++ "_caption")
		Message = Message ++ TabChar ++ "(Caption: " ++ OpQuote ++ Values
		Message = Message ++ ClQuote ++ ")"
	endif

	Message = Message ++ CR
endfor

Message = Message ++ CR ++ "Open these tabs from file " ++ TabFile ++ "?"
Message = Message ++ CR ++ "'Yes': Replace current tabs"
Message = Message ++ CR ++ "'No': Add tabs, keep current"

Temp = messagebox("yesnocancel question", Message, "Tab file: " ++ TabFile)
;OpenTabs - name of script OpenTabs;
if(Temp == 6) do
	runfile.OpenTabs(file.nametype(TabFile))
elseif(Temp == 7) do
	runfile.OpenTabs(file.nametype(TabFile), 1)
endif

Comments:

Script displays some general information about selected file with saved tabs, without actually loading it. It allows to avoid losing current tabs.

The path_to_tabs should correspond to the TabDir key in wincmd.ini. If no parameter is provided, then the script will ask you to pick any *.tab file.

In the dialog box the "Yes" button allows to open tabs from file, "No" button adds them to current tabs, and, finally, the "Cancel" button closes the window.


Main Page Total Commander PowerPro