|
|
| Title | TreeDown |
| File Name | TreeDown.txt |
| Description | Move up the directory tree |
| Author | Vochomurka (idea by Gregory) |
| Parameters | "%p", "%n" |
| Plugins Called | win, file, tc |
| Icon |
|
| Version | 1.0 |
| Updated on | 23.10.2005 |
local hwnd = win.handle("c=TTOTAL_CMD")
local Path = arg(1)
local Name = arg(2)
local List, Counter, Slash, j, One
if(select(Path, 2) == "\\") do
Slash = "Script works only in directory tree, not network or special folders"
messagebox("ok error", Slash, "TreeDown Script")
quit
endif
if(file.isfolder(Path ++ Name) == "1" && Name != "") do
win.sendmessage(hwnd, 0x400+51, 2003, 0)
quit
endif
if(file.isfolder(Path ++ Name) == "0") do
if(length(Path) == 3) do
Path = select(Path, 2)
Slash = "Last folder in root visited. Go to the next drive?"
if(messagebox("yesno warning", Slash, Path ++ " root") == 7)
quit
win.sendmessage(hwnd, 0x400+51, 2051, 0)
win.sendmessage(hwnd, 0x400+51, 2001, 0)
quit
endif
Path = remove(Path, -1)
Slash = revindex(Path, "\")
Name = select(Path, Slash - length(Path))
Path = select(Path, Slash)
endif
Path = remove(Path, -1)
for(1)
List = file.listfiles(Path, 2, 0, 1)
Counter = line(List, 0)
if(Counter == 0) do
Slash = revindex(Path, "\")
Name = select(Path, Slash - length(Path))
Path = select(Path, Slash - 1)
win.sendmessage(hwnd, 0x400+51, 2002, 0)
else
Slash = "z;"
flag clear 1
for(j = 1; j <= Counter; j = j + 1)
One = file.getShortPath(line(List, j))
if(file.isfolder(One) == "1" && min(One, Path ++ "\" ++ Name) != One) do
flag set 1
Slash = min(One, Slash)
endif
endfor
if(pproflag(1)) do
tc.cd(hwnd, Slash)
keys {home}
quit
else
if(length(Path) == 2) do
Path = select(Path, 2)
Slash = "Last folder in root visited. Go to the next drive?"
if(messagebox("yesno warning", Slash, Path ++ " root") == 7)
quit
win.sendmessage(hwnd, 0x400+51, 2051, 0)
win.sendmessage(hwnd, 0x400+51, 2001, 0)
quit
endif
Slash = revindex(Path, "\")
Name = select(Path, Slash - length(Path))
Path = select(Path, Slash - 1)
endif
endif
endfor
What is meant by "move down the directory tree"? Open the directory tree file composed by Total Commander (treeinfo.wc). You'll see all the directories of some logical disk in the directory structure order.
The same order is demonstrated with the "Tree View". Each time you press the Right key, you go to the next directory, or move one directory down. This script does the same. What are the advantages of script over the Tree View?
It's a good idea to assign the Alt+PgDn and Alt+PgUp hotkeys to TreeDown and TreeUp scripts, respectively.
If you reach the last directory on the current disk and run the script again, you can go to the next disk after confirmation. Thus, you can visit all directories of your computer. The same is valid when moving up with TreeUp script.
More stable scripts are TreeDownX and TreeUpX to move up and down. As to me, after developing them I get rid of TheeDown and TreeUp scripts.
What does "more stable" mean? It means that TheeDown and TreeUp scripts work somewhat faster than TheeDownX and TreeUpX when executed in a directory where the quantity of files/directories is not great. Otherwise, the contrary happens: TheeDown and TreeUp get very-very slow, while TheeDownX and TreeUpX have almost the same operating speed despite the number of files.
|
Main Page |
|
Total Commander |
|
PowerPro |
|
|