SelectFilter

Title SelectFilter
File Name SelectFilter.txt
Description Select/unselect files/directories with predefined filter
Author Vochomurka
Parameters ("Filter_Name", "1|2")
Plugins Called ini, vec, win
Icon depends on filter
Version 1.0
Updated on 19.08.2006
args Key, Comm
local hwnd = win.handle("c=TTOTAL_CMD")
local i, Temp, Flags, Pos
local INIfile = "path\wincmd.ini"
local AllKeys = ini.enum_keys(INIfile, "Searches")
local Total = line(AllKeys, 0)
local Counter = 0
local SF = "_SearchFor"

for(i = 1; i <= Total; i++)
	Temp = line(AllKeys, i)
	if(index(Temp, SF))
		Counter++

endfor

v = vec.create(Counter)
if(v == 0) do
	messagebox("ok error", "Vector not created", "VEC plugin error")
	quit
endif

Counter = 0

for(i = 1; i <= Total; i++)
	Temp = line(AllKeys, i)
	if(index(Temp, "_SearchFlags")) do
		Flags = ini.get(INIfile, "Searches", Temp)
		Pos = length(Flags) - 3

		if(select(Flags, Pos, Pos)) do
			Counter--
			continue
		endif
	endif

	if(index(Temp, SF)) do
		v[Counter] = Temp
		Counter++
	endif
endfor

vec.sort(v)
Counter = vec.binsearch(v, Key ++ SF)
vec.destroy(v)

Comm = 520 + Comm
win.postmessage(hwnd, 0x400+51, Comm, 0)
wait.for(1500, win.visible("c=TCOMBOINPUT"))
*keys {tab}{right}

for(i = 1; i <= Counter; i++)
	*keys {down}
endfor

*keys {enter}

Comments:

Press the gray plus key and select a filter to select files/directories. If this list is long enough, finding a desired filter can take a long time. By specifying parameters, say, ("MyFilter", "1") you can select files according to "MyFilter" with one click/hotkey.

Second parameter can be "1" - select, and "2" - unselect.

My advice is: create filters "Only files, not directories", and "Only directories, not files", add new start menu commands calling the script, and assign Ctrl+Alt+F and Ctrl+Alt+D hotkeys, respectively.


Main Page Total Commander PowerPro