Page 1 of 1

Function to copy to clipboard only the selected filename(s)

Posted: 2012-02-25, 19:56 UTC
by sidefx88
I use a lot the function cm_CopyNamesToClip, but it copies filename and extension of selected files.

I'm wondering if it possible to add a command which it copies ONLY the filename (without extension). It is a function I would appreciate, I will use it a lot, and I guess another users too.

Something like "cm_CopyFilenameToClip"...

Thanks in advance!

Posted: 2012-02-25, 21:06 UTC
by MVV
Can't imagine situation where such function may be useful. :)

Currently you may use following trick:
1. Select file(s)
2. Open MRT (multi-rename tool, Ctrl+M)
3. Specify [N] as name template and empty extension template
4. Click small button with clipboard icon (to the right of case mode selection) and select 'Edit names...'. TC will open filelist in editor, you may copy names and close editor and MRT.

You may create special template and load it by hotkey via usercommand with MULTIRENAME command.

Posted: 2012-02-25, 21:14 UTC
by karlchen
Hello, sidefx88.

Provided you are still using a 32-bit version of Total Commander on Windows, a little utility created by Lefteous a long time ago may be able to help you achieve your goal: List2Clipboard 1.02.

As you posted in the TC Suggestions sub-forum, I would like to support the idea that some such features should be implemented into Total Commander natively. :)

Kind regards,
Karl

Posted: 2012-02-25, 21:52 UTC
by Stefan2
One possible way if utilizing DOS


User.ini

Code: Select all

[em_CopyBasenameToClip]
cmd=%comspec% /c
param=del %%tmp%%\tctmp & for /f "tokens=*" %%B in ('dir /b %S') do @echo %%~nB >> %%tmp%%\tctmp & type %%tmp%%\tctmp |clip
or the same but directly as button

Code: Select all

TOTALCMD#BAR#DATA
%comspec% /c
del %%tmp%%\tctmp & for /f "tokens=*" %%B in ('dir /b %S') do @echo %%~nB >> %%tmp%%\tctmp & type %%tmp%%\tctmp |clip
WCMICONS.DLL
Copy base name only to clipboard

1
-1
(note that "del" to "clip" should be one single line! But depending on your screen resolution it may be broken into two lines.)



Explanation:

"clip" is the WinXP clip.exe

%S is an TC parameter

Code: Select all

%S insert the names of all selected files into the command line. 
Names containing spaces will be surrounded by double quotes. 
Please note the maximum command line length of 32767 characters.
The rest is pure dos.




Note: on first run there is an error msg because of the "DEL tctmp" command
while there is no tctmp existend yet, but you don't see it and it doesn't matter.



HTH?

Posted: 2012-02-26, 08:27 UTC
by MVV
karlchen wrote:As you posted in the TC Suggestions sub-forum, I would like to support the idea that some such features should be implemented into Total Commander natively. :)
I would support new internal command with parameter string specifying which WDX fields to copy, just like in tooltips or custom columns. So, every copy would be satisfied!

Code: Select all

cm_CopyDetailFields [=tc.name]
cm_CopyDetailFields [=tc.fullname]\t[=tc.versionstring]
cm_CopyDetailFields [=tc.fullname]\t[=exif.Width]x[=exif.Height]
etc.
Also similar command may be added to save such data to a file.
Anyway TC is already able to build such strings since it does it in many other places.

Posted: 2012-02-26, 11:50 UTC
by karlchen
Hello, MVV.

Actually, my idea, though not expressed explicitly, was along the line that the features which Lefteous addon List2Clip offers might be included in Total Commander.
The new internal command that you suggest might be more flexible, though I am not sure whether it covers all the string manipulations which Lefteous's list2clip can perform.

A hint why being able to manipulate strings got by the various copy names to clip functions may be helpful or even needed: copy path to clipboard - wine

Anyway, we are free to express wishes. We will learn whether any of them will be fulfilled one day in a far away future. :wink:

Kind regards,
Karl

Posted: 2012-02-26, 13:52 UTC
by sidefx88
Thanks for your tips! But they need intricated procedures or additional software. They're complex compared to a simple, native 'cm_CopyFilenameToClip' command I suggested :)

I'd use this function a lot: select MP3 files and copy only the filename to create quick plain txt playlists (without the annoying MP3 extension).

Thanks!