Title ClipFileList
File Name ClipFileList.txt
Description Copy file name(s) to the clipboard. Advanced replacement for Total Commander's command with numbers 2007-2009, 2017-2018, 2029
Author Vochomurka
Parameters ("%L", "n|p|o|e|f|s|q", "depth", "slash", "prefix", "suffix", "quote")
(see Comments)
Plugins Called file, ini, vec, clip
Icon depends on parameters
Version 1.2
Updated on 13.10.2005

local fh =, "r")
local Str, Counter, What, Depth, i, j 
local Char, Slash, Len, Path
setstring Quote "
local Before = arg(5)
local After = arg(6)
local QuoteString = arg(7)

if(QuoteString != "") do
	Before = replacechars(Before, QuoteString, Quote)
	After = replacechars(After, QuoteString, Quote)

if(fh > 0) do
		Str = file.readstring(fh)
		if(Str != 0)
			Counter = Counter + 1
	messagebox("ok error", "File not opened", "FILE plugin error")

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

What = case("lower", arg(2))
Depth = ifelse(miscplugin.is_int(arg(3)) == "1", arg(3), 0)

for(i = 0; i < Counter; i = i + 1)
	Str = file.readstring(fh)
	v[i] = Str

	if(Depth != 0 && Depth != "") do
;Sub_ParsePath - name of ParsePath script;
		Path = runfile.Sub_ParsePath(Str, Depth)
		Path = Path ++ "\"
		Path = file.folder(Str) ++ "\"

	if(What == "n") do
		v[i] = file.nametype(Str)
	elseif(What == "f") do
		v[i] = Path ++ file.nametype(Str)
	elseif(What == "p") do
		v[i] = remove(Path, -1)
	elseif(What == "o") do
		v[i] =
	elseif(What == "e") do
		v[i] = file.type(Str)
	elseif(What == "s") do
		v[i] = file.size(Str)
	elseif(What == "q") do
		v[i] = Path ++
	if(arg(4) != "")
		v[i] = replacechars(v[i], "\", arg(4))
	v[i] = Before ++ v[i] ++ After


Str = vec.makelines(v)


List To Clipboard or List2Clip utility is, as its readme says, "an improvement to the internal commands":

The more I used List2Clip, the more it annoyed me. Finally, since I have developed my script, I completely get rid of this utility.

Why List2Clip is better than my script? First, List2Clip can process network paths, while the script cannot. The fact is that my computer is a standalone one, and thus I am not able to debug the network functions. Second, List2Clip can replace "something" to "whatever", while the script cannot. I've just never being faced with the necessity to perform such replacements, though it can be easily implemented.

Why List2Clip is worse than my script? First, List2Clip cannot process quotes. Second, List2Clip cannot copy the file size(s), that I need badly.

Suppose there is a file c:\One\Two\Three\name.ext with size equal to 123 bytes. All the examples below deal with a single file, but the same works for a group, that is, when some files are selected.

First script parameter is always "%L". Second parameter can be one of the following (lower or upper case):

 Second parameter  Result
"n"  name.ext
"p"  c:\One\Two\Three
"o"  name
"e"  ext
"f"  c:\One\Two\Three\name.ext 
"s"  123
"q"  c:\One\Two\Three\name

Third parameter is a path depth - number of subdirectory levels countuing from the current one to the root. Third parameter matters only if the second one is "p", "f" or "q", that is, deals with path. If the third parameter is "", zero or exceeds the maximum path depth (being 4 in our case), or is not an integer, the result is the same as if the third parameter doesn't exist. However, if the script requires fourth and/or subsequent parameter(s), the third parameter must be present. In this case the "" value is recommended.

For example, the script with parameters ("%L", "f", "2") puts Two\Three\name.ext to the clipboard.

Fourth parameter is a character or string to replace the "\" character. At creating web-pages the backslash usually requires to be replaced by "/". But if there is a need to replace the "\" with "_", just specify, for example ("%L", "f", "", "_"). It would copy c:_One_Two_Three_name.ext to the clipboard.

Fifth and sixth parameters are strings to add before and after the file name. Thus, to copy to the clipboard the <a href=c:/One/Two/Three>hyperlink text</a> string, specify the following parameters: ("%L", "p", "", "/", "<a href=", ">hyperlink text</a>").

Seventh parameter matters only if there is a need to add the double quote (") character to the clipboard. Parameter can have any value except for ", for example, quote. In this case the quote string in 5th and/or 6th parameter will be replaced with the double quote character. For example, let's put the hyperlink to the current file, considering path depth of 3, quoting the file name and replacing "\" with "/": ("%L", "q", "3", "/", "<a href=quote", "quote></a>", "quote"). It yields <a href="c:\One\Two\Three\name"></a>. The only thing to do is to paste the clipboard contents into your editor.

The only parameter the script requires is the first one always equal to %L. If there is no more parameters, the second is supposed to be "f" (Full file name). As it was said above, if third and subsequent parameters are not used, they can be omitted. Otherwise, they must be present, usually just as "".

For example, it you need to put the c:\One\Two\Three\name.ext - full filename string to the clipboard, specify the following script parameters: ("%L", "", "", "", "", " - full filename").

As to me, I created the button bar with many buttons each calling the ClipFileList script with various parameters.

However, if this script does not cover your needs, please refer to the ClipListDialog script.

Main Page Total Commander PowerPro