TreeUpCmd

Title TreeUpCmd
File Name TreeUpCmd.txt
Description Move up the directory tree
Author Vochomurka
Parameters ("%p", "%n")
Plugins Called file, miscplugin
Icon
Version 1.0
Updated on 24.06.2006
args Path, Name
local hwnd = win.handle("c=TTOTAL_CMD")
local Slash

if(select(Path, 2) == "\\") do
	Slash = "Script works only in directory tree, not network or special folders"
	messagebox("ok error", Slash, "TreeUp Script")
	quit
endif

Path = file.folder(Path)
Slash = revindex(Path, "\")

if(Slash) do
	Name = file.nametype(Path)
	Path = file.folder(Path)
else
	Slash = "First folder in root visited. Go to the previous drive?"

	if(messagebox("yesno warning", Slash, select(Path, 2) ++ " root") == 7)
		quit

	win.sendmessage(hwnd, 0x400+51, 2052, 0)		
	win.sendmessage(hwnd, 0x400+51, 2001, 0)		
	quit
endif

for(1)
;Sub_TreeUpCmd - name of script TreeUpCmd 
	Slash = runfile.Subs\Sub_TreeUpCmd(Path, Name)
	if(not Slash) do					
		tc.cd(hwnd, Path)
		keys {home}
		quit
	endif

	if(Slash != Name) do					
		Path = Path ++ "\" ++ Slash
		break
	endif

	Name = file.nametype(Path)
	Path = file.folder(Path)				
endfor								

for(1)
;Sub_LowestDirCmd - name of script LowestDirCmd 
	Slash = runfile.Subs\Sub_LowestDirCmd(Path)
	if(not Slash) do										
		tc.cd(hwnd, Path)
		keys {home}
		quit
	endif

	Path = Slash
endfor								

Comments:

Two major advantages of this script over TreeUpX script are: it does not need any external utility; and it works by 8-9% faster.


All Scripts Total Commander TotalCmd.net PowerPro