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