|
Title | Nextension |
File Name | Nextension.txt |
Description | Move cursor to the first file with next extension |
Author | Vochomurka |
Parameters | ("%P", "%E", selection) |
Plugins Called | win, miscplugin, vec, file |
Icon | |
Version | 2.1 |
Updated on | 15.03.2010 |
args Path, Ext, Sel static hwnd = win.handle("c=TTOTAL_CMD") static Exepath = win.exepath(hwnd) static Quote = esc(?+\"+, ?+\+) if(not Ext) do win.sendmessage(hwnd, 0x400+51, 2050, 0) Ext = "!!!" endif static Counter, PrevPath local Str, Type, i if(Counter && PrevPath == Path) jump SecondCall if(vec.exists(v)) do vec.destroy(v) Counter = "" endif PrevPath = Path local Report = miscplugin.tempfilename() Str = "/c dir " ++ Path ++ " /a:-d /o:e /b > " ++ Report local ExitCode = file.runwait(0, "cmd", Str, "", "hide") if(ExitCode) do messagebox("ok error", "File list not created", "CMD error") quit endif Str = file.readall(Report) v = vec.createfromlines(Str, 1, 1) if(v <= 0) do messagebox("ok error", "Vector not created", "VEC plugin error #1") quit endif for each Str in v if(not Str) continue Type = file.type(Str) if(Counter) do flag set 1 for(i = 0; i < Counter; i++) if(Type == file.type(v[i])) do flag clear 1 break endif endfor if(pproflag(1)) do vec.insert(v, Counter, Str) Counter++ else if(stricoll(v[i], Str) == 1) v[i] = Str endif else v[0] = Str Counter++ endif endfor @SecondCall for(i = 0; i < Counter - 1; i++) if(Ext != file.type(v[i])) continue Str = v[i + 1] do(Exepath,"/O /S /L=" ++ Quote ++ Path ++ Str ++ Quote) if(Sel) do win.sendmessage(hwnd, 0x400+51, 524, 0) win.sendmessage(hwnd, 0x400+51, 527, 0) endif break endfor
When investingating some new set of files (for example, directories on just bought CD) it is convenient to browse files by extension. But if there are too many files, looking for all files with the next (alphabetically) extension can be a boring job.
Before running the script it is most pictorial to sort files by extension (cm_SrcByExt and similar commands). Third parameter, if absent, null string, or zero, allows to move the cursor to the first file with the next extension. Any other value of third parameter also selects all files with the same extension. It allows to learn their quantity and total size.
All Scripts | Total Commander | TotalCmd.net | PowerPro |