|Description||Load specific custom columns|
|Plugins Called||win, ini, vec, file|
local NewLine = esc(?+\r\n+, ?+\+) local Path = arg(1) local Config = "path\wincmd.ini" local Settings = "path\WDXdetect.ini" local hwnd = win.handle("c=TTOTAL_CMD") local Temp = ini.get(Config, "CustomFields", "Titles") Temp = replacechars(Temp, "|", NewLine) v = vec.createfromlines(Temp) local Plugins = vec.length(v) local Str, i, j flag clear 1 if(file.validpath(Path ++ "descript.ion") == 1) do local Hand = file.open(Path ++ "descript.ion", "r") if(Hand > 1) do for(not(file.eof(Hand))) Str = file.readstring(Hand) if(index(Str, ":") == "1") do file.close(Hand) flag set 1 break endif endfor if(pproflag(1)) do for(i = 0; i < Plugins; i = i + 1) if(index(Str, v[i]) != 0) do Temp = 271 + i win.postmessage(hwnd, 0x400+51, Temp, 0) vec.destroy(v) quit endif endfor endif else messagebox("ok error", "File not opened", "FILE plugin error") quit endif endif ;Sub_ParsePath - name of script ParsePath local Depth = runfile.Subs\Sub_ParsePath(Path, "") Path = remove(Path, -1) for(j = 1; j < Depth; j = j + 1) if(ini.check_exists(Settings, "Dirs", Path) == 3) do Str = ini.get(Settings, "Dirs", Path) for(i = 0; i < Plugins; i = i + 1) if(index(Str, v[i]) != 0) do Temp = 271 + i win.postmessage(hwnd, 0x400+51, Temp, 0) vec.destroy(v) quit endif endfor endif Str = file.folder(remove(Path, -1)) Path = Str endfor vec.destroy(v)
In the Total Commander forum there are many requests about automatic loading specific custom views for specific directories. Certianly, the presented script makes no pretence of solving this problem. The script can be configured such that the necessary view is loaded not automatically, but with just one click or hotkey. There are two ways to assign a view to a directory.
First way is to edit the descript.ion file in the directory in question, adding the following line:
Instead of CustomView you should indicate the name of custom view appropriate for this directory. This name can be taken from the following sources:
Please note that the colon character must be the first character of the line. There would be no conflicts because no file name can contain the ":" character. This line can be both the only line in descript.ion and one of numerous comments. This line can be located both in the very beginning of file and in the end. But the former location could slightly increase the processing speed.
If there is no descript.ion in the current directory, or it does not contain the line described, then the script tries to go the second way of loading custom view. For the second way the configuration file WDXdetect.ini is used. Don't forget to indicate path to the configuration in the script code.
File WDXdetect.ini has the only section [Dirs] containing any number of keys
First way has a higher priority over the second one.
Version 1.1 of script introduces two new features: first, if some directory is described in the configuration file, then the custom view indicated relates not only to this directory, but to its children, too. Second - directory in the configuration is not anymore ended with "\" (see example above).
May be, the configuration should contain the associations that would hardly be ever changed. Instead, the descript.ion can be used to describe trial and temporary settings. It is important that after finding the first line beginning with ":", the script does not search for the subsequent ones. Thus, by simple exchange of lines you can load one or another custom view.
The script has some advantages over the conditional (from right-click menu) method to load the custom view. First, this list can be quite long (for example, I have 15 views available, and I am sure that some people need much more). Second, you could just forget the name of necessary view.
|Main Page||Total Commander||PowerPro|