Copy file contents to the clipboard

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
pplupo
Member
Member
Posts: 102
Joined: 2019-12-02, 16:26 UTC
Location: Canada
Contact:

Copy file contents to the clipboard

Post by *pplupo »

I've just released this integration script that copies file's contents to the clipboard when clicking a button:
http://totalcmd.net/plugring/CopyContents.html

As the publications in totalcmd.net allow us to provide a forum discussion topic, I'm creating this here as a communication channel.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy file contents to the clipboard

Post by *petermad »

2pplupo
In the description on totalcmd.net you write:
Script to be used as a button to copy the contents of the target file to the clipboard.
But you also suggest the following use:
Command: "\Copy File Contents.bat"
Parameters: %P%N
If you use %P%N - would it not be more correct to call it the source file? Otherwise yiu should suggest to use %T%M
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Copy file contents to the clipboard

Post by *nsp »

Good job PePe, specially because all is exposed in gitlab.
To make your script easier to use, you should create small snippet file/readme to create user command instead of button as it can be used as an alias or in a key shortcut.
If you want to use button, then the easier is to use the export from the button itself.
pplupo
Member
Member
Posts: 102
Joined: 2019-12-02, 16:26 UTC
Location: Canada
Contact:

Re: Copy file contents to the clipboard

Post by *pplupo »

petermad wrote: 2021-05-19, 01:17 UTC 2pplupo
In the description on totalcmd.net you write:
Script to be used as a button to copy the contents of the target file to the clipboard.
But you also suggest the following use:
Command: "\Copy File Contents.bat"
Parameters: %P%N
If you use %P%N - would it not be more correct to call it the source file? Otherwise yiu should suggest to use %T%M
You are right. And actually, I've just tried with %S and it works, so it will work on any panel. I've updated it there already. Thank you very much.
pplupo
Member
Member
Posts: 102
Joined: 2019-12-02, 16:26 UTC
Location: Canada
Contact:

Re: Copy file contents to the clipboard

Post by *pplupo »

nsp wrote: 2021-05-19, 06:11 UTC Good job PePe, specially because all is exposed in gitlab.
To make your script easier to use, you should create small snippet file/readme to create user command instead of button as it can be used as an alias or in a key shortcut.
If you want to use button, then the easier is to use the export from the button itself.
Thanks! :-)

I'd love to learn how to do those (user command and export the button). Do you have references? :-)
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy file contents to the clipboard

Post by *petermad »

I'd love to learn how to do those (user command and export the button).
To export a button just right click the button and choose: "Copy"
You can then paste the code for the button to a text file.
When you want to make a copy of the button, you just do the reverse - select the pasted text, right click on the button bar and choose "Paste"

User commands you find in the file usercmd.ini file (in the same folder as your wincmd.ini file). You can either edit it manually or you can use the "Choose Command" dialog opened by the cm_CommandBrowser command - here you go down to the section usercmd.ini near the button - when you click on that buttons for making New user commands or Edit existing ones will appear.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
pplupo
Member
Member
Posts: 102
Joined: 2019-12-02, 16:26 UTC
Location: Canada
Contact:

Re: Copy file contents to the clipboard

Post by *pplupo »

petermad wrote: 2021-05-19, 19:10 UTC
I'd love to learn how to do those (user command and export the button).
To export a button just right click the button and choose: "Copy"
You can then paste the code for the button to a text file.
When you want to make a copy of the button, you just do the reverse - select the pasted text, right click on the button bar and choose "Paste"

User commands you find in the file usercmd.ini file (in the same folder as your wincmd.ini file). You can either edit it manually or you can use the "Choose Command" dialog opened by the cm_CommandBrowser command - here you go down to the section usercmd.ini near the button - when you click on that buttons for making New user commands or Edit existing ones will appear.
@petermad, thank you!!!
Post Reply