Clipboard parameter for button bars
Moderators: Hacker, petermad, Stefan2, white
Clipboard parameter for button bars
There are loads of percent-prefixed parameters for button bar.
Should yet another one to be considered - for clipboard contents?
Most useful it might be for launching programs that are getting links from command line, but other scenarios are possible too.
Should yet another one to be considered - for clipboard contents?
Most useful it might be for launching programs that are getting links from command line, but other scenarios are possible too.
Re: Clipboard parameter for button bars
I use the NirSoft tool Nircmd.exe for this purpose.
The following button displays a folder in TC which is read from the Clipboard.
Usercmd.ini entry
The following button displays a folder in TC which is read from the Clipboard.
Code: Select all
TOTALCMD#BAR#DATA
em_CDToClip
C:\Tools\Wincmd\Icons\Right-Blue.ico
CD Clipboard
0
10297
Code: Select all
[em_CDToClip]
cmd=c:\tools\NirSoft\x64\nircmd.exe exec show %COMMANDER_EXE% /O /S /A /L="~$clipboard$"
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Clipboard parameter for button bars
The parameter is not quite suitable for this, because multiline text can be copied. It would be better if it were an environment variable, although it also has a length limit.
Personally, I prefer to handle the clipboard with scripts, because extra characters, including whitespace, often get there. In this case, you don't need to adjust specifically to a command or button, like the one above.
Personally, I prefer to handle the clipboard with scripts, because extra characters, including whitespace, often get there. In this case, you don't need to adjust specifically to a command or button, like the one above.
Overquoting is evil! 👎
Re: Clipboard parameter for button bars
Already was. Use help button in TC.
Re: Clipboard parameter for button bars
I've done this before. There is no word "clipboard" on the "Environment variables" page.
If there was such a variable, then there would be no point in requesting a parameter.
There is only the [X] placeholder for MRT.
Overquoting is evil! 👎
Re: Clipboard parameter for button bars
Adding an environment variable or pseudo-variable is not easier than a new parameter.
A true environment variable might get stale.
It would be a waste to add intermediate storage between clipboard and required parameter for a button.
A true environment variable might get stale.
It would be a waste to add intermediate storage between clipboard and required parameter for a button.
Re: Clipboard parameter for button bars
Wrong. Try to execute from deep folder a few times: cd ..\%cd%
The path changes. What does this mean? That the variable is not outdated.
The same applies to variables such as COMMANDER_OPEN after changing conditions.
The path changes. What does this mean? That the variable is not outdated.
The same applies to variables such as COMMANDER_OPEN after changing conditions.
Overquoting is evil! 👎
Re: Clipboard parameter for button bars
Examples of true environment variables: path, tmp.
%cd% is not, it is an internal TC's variable (launch cmd.exe, try your command).
An intermediate variable for accessing clipboard contents is not cheaper than an additional %-parameter. Also it would be in the same help page, not elsewhere.
%cd% is not, it is an internal TC's variable (launch cmd.exe, try your command).
Might mean, you are posting nonsense and messing up a very simple suggestion.
An intermediate variable for accessing clipboard contents is not cheaper than an additional %-parameter. Also it would be in the same help page, not elsewhere.
Re: Clipboard parameter for button bars
%cd% is not an internal TC variable, but an internal cmd.exe variable.browny wrote: 2024-10-10, 08:40 UTC Examples of true environment variables: path, tmp.
%cd% is not, it is an internal TC's variable (launch cmd.exe, try your command).
Edit:
In response to post below:
Of course the command "cd ..\c:\bin\wc" results in an error.browny wrote: 2024-10-10, 08:51 UTC From cmd.exe window:Code: Select all
c:\bin\wc>cd ..\%cd% The filename, directory name, or volume label syntax is incorrect.
Re: Clipboard parameter for button bars
From cmd.exe window:
Shall we stay on topic?
Edit. In response to the edit above.
Now try cd ..\%cd% in TC's command line input field.
Any difference in behaviour? If so, what is %cd% variable in this case?
Code: Select all
c:\bin\wc>cd ..\%cd%
The filename, directory name, or volume label syntax is incorrect.
Edit. In response to the edit above.
Now try cd ..\%cd% in TC's command line input field.
Any difference in behaviour? If so, what is %cd% variable in this case?
Last edited by browny on 2024-10-11, 09:54 UTC, edited 1 time in total.
Re: Clipboard parameter for button bars
All variables are true, regardless of whether they are internal or system.browny wrote: 2024-10-10, 08:40 UTC Examples of true environment variables: path, tmp.
%cd% is not, it is an internal TC's variable (launch cmd.exe, try your command).
It wasn't a question for you. Are you unable to distinguish a rhetorical question from a direct one from the context?browny wrote: 2024-10-10, 08:40 UTC Might mean, you are posting nonsense and messing up a very simple suggestion.
Rough and unfounded assessments do not interest me.
The help page is the last thing to think about. Implementation is much more important. I do not know how you measure the cheapness, but I pointed out the most important factor - multiline, which is excluded for a single-line parameter.browny wrote: 2024-10-10, 08:40 UTC An intermediate variable for accessing clipboard contents is not cheaper than an additional %-parameter. Also it would be in the same help page, not elsewhere.
Overquoting is evil! 👎
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Clipboard parameter for button bars
For the next beta, I have added two new pseudo environment variables %$CLIPBOARD% and %$CLIPNAME% with the following options:
%$CLIPBOARD% Inserts up to 1023 unmodified characters from the clipboard
%$CLIPBOARD0% Like %$CLIPBOARD%, but line breaks are replaced by spaces
%$CLIPBOARD1%, %$CLIPBOARD2% Inserts line 1, line 2 etc. from the clipboard, otherwise unchanged
%$CLIPNAME% Inserts up to 1023 characters from the clipboard, replaces the characters *?:|"<> that are forbidden in file names with underscores_
%$CLIPNAME0% Like %$CLIPNAME%, but line breaks are replaced by spaces
%$CLIPNAME1%, %$CLIPNAME2% Inserts line 1, line 2 etc. from the clipboard, replaces the characters *?:|"<> that are forbidden in file names with underscores_
What do you think?
%$CLIPBOARD% Inserts up to 1023 unmodified characters from the clipboard
%$CLIPBOARD0% Like %$CLIPBOARD%, but line breaks are replaced by spaces
%$CLIPBOARD1%, %$CLIPBOARD2% Inserts line 1, line 2 etc. from the clipboard, otherwise unchanged
%$CLIPNAME% Inserts up to 1023 characters from the clipboard, replaces the characters *?:|"<> that are forbidden in file names with underscores_
%$CLIPNAME0% Like %$CLIPNAME%, but line breaks are replaced by spaces
%$CLIPNAME1%, %$CLIPNAME2% Inserts line 1, line 2 etc. from the clipboard, replaces the characters *?:|"<> that are forbidden in file names with underscores_
What do you think?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Clipboard parameter for button bars
Sounds great! A long awaited feature...
Thank you!
Thank you!
Re: Clipboard parameter for button bars
This should cover many more cases than were expected initially.
Re: Clipboard parameter for button bars
Very nice, so I can remove Nirsoft form many buttons.
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64