clip.save local hwnd = win.handle("c=TTOTAL_CMD") local Panel = ifelse(tc.active(hwnd) == "left", 8, 7) local Drive = childwin.handle(hwnd, "TMyListBox", Panel) local Result = win.sendmessage(Drive, 0x0188, 0, 0) static Slash = "\" static Quote = esc(?+\"+, ?+\+) clip.clear win.sendmessage(hwnd, 0x400+51, 2029, 0) wait.for(clip.get) local Path = clip.get Drive = slice(Path, 3) local Name if(not validpath(Drive)) do messagebox("ok error", "Unknown drive: " ++ Drive, "Invalid path") clip.load quit endif if(not Result && Path == Drive) do win.sendmessage(hwnd, 0x400+51, 2017, 0) wait.for(clip.get) Name = clip.get tc.cd(hwnd, Path ++ Name) clip.load quit endif if(Result) do win.sendmessage(hwnd, 0x400+51, 2017, 0) wait.for(clip.get) Name = clip.get endif clip.load local FullPath = Path ++ Slash ++ Name if(file.isfolder(FullPath) && Name) do win.sendmessage(hwnd, 0x400+51, 2003, 0) quit endif if(not file.isfolder(FullPath)) do if(length(Path) <= 3) NextDrive(hwnd) Name = file.nametype(Path) Path = file.folder(Path) endif for(1) Result = Down(Path, Name) if(Result == -1) quit if(not Result) do if(length(Path) <= 3) NextDrive(hwnd) Name = file.nametype(Path) Path = file.folder(Path) else tc.cd(hwnd, Result) keys {home} quit endif endfor quit //============================================= Function Down(Path, Name) local FullPath = Path ++ ifelse(Name != "", Slash ++ Name ++ Slash, Slash) Path = PutQuote(Path ++ "\*.*") FullPath = trim(FullPath, Quote, 3) local Report = miscplugin.tempfilename() local Str = Path ++ " /ltree /dl2 /h /e /fo" ++ Report local ExitCode = file.runwait(0, "c:/utils/xxcopy/xxcopy.exe", Str, "", "hide") local i if(ExitCode != 0 && ExitCode != 100) do messagebox("ok error", "XXcopy error #" ++ ExitCode, "TreeDownXMouse Script") quit(-1) endif local Temp = file.readall(Report) Report = line(Temp, 0) if(Report == 1) quit local v = vec.create(Report) if(v <= 0) do messagebox("ok error", "Vector not created", "VEC plugin error") quit(-1) endif for(i = 0; i < Report; i++) Str = trim(line(Temp, i + 1), "", 2) v[i] = trim(Str, " ", 2) endfor v.sortstring Temp = v.binsearch(FullPath) if(Temp == -1 || Temp + 1 == Report) do quit else quit(v[Temp + 1]) endif quit //============================================= Function PutQuote(Str) if(find(Str, " ") != -1) do Str = trim(Str, Quote, 3) Str = Quote ++ Str ++ Quote endif quit(Str) //============================================= Function NextDrive(hwnd) *Exec Prompt 1 Last folder in root visited. Go to the next drive? if(not pproflag(1)) quit all win.sendmessage(hwnd, 0x400+51, 2051, 0) win.sendmessage(hwnd, 0x400+51, 2001, 0) quit all