Page 1 of 3
Clipboard parameter for button bars
Posted: 2024-10-09, 11:06 UTC
by browny
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.
Re: Clipboard parameter for button bars
Posted: 2024-10-09, 11:43 UTC
by Horst.Epp
I use the NirSoft tool Nircmd.exe for this purpose.
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
Usercmd.ini entry
Code: Select all
[em_CDToClip]
cmd=c:\tools\NirSoft\x64\nircmd.exe exec show %COMMANDER_EXE% /O /S /A /L="~$clipboard$"
Re: Clipboard parameter for button bars
Posted: 2024-10-09, 12:45 UTC
by Fla$her
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.
Re: Clipboard parameter for button bars
Posted: 2024-10-09, 13:15 UTC
by browny
Fla$her wrote: 2024-10-09, 12:45 UTC
It would be better if it were an environment variable
Already was. Use help button in TC.
Re: Clipboard parameter for button bars
Posted: 2024-10-09, 13:27 UTC
by Fla$her
browny wrote: 2024-10-09, 13:15 UTC
Already was. Use help button in TC.
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.
Re: Clipboard parameter for button bars
Posted: 2024-10-09, 15:24 UTC
by browny
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.
Re: Clipboard parameter for button bars
Posted: 2024-10-09, 15:54 UTC
by Fla$her
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.
Re: Clipboard parameter for button bars
Posted: 2024-10-10, 08:40 UTC
by browny
Examples of true environment variables:
path,
tmp.
%cd% is not, it is an internal TC's variable (launch cmd.exe, try your command).
Fla$her wrote: 2024-10-09, 15:54 UTC
What does this mean?
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
Posted: 2024-10-10, 08:49 UTC
by white
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).
%cd% is not an internal TC variable, but an internal cmd.exe variable.
Edit:
In response to post below:
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.
Of course the command "cd ..\c:\bin\wc" results in an error.
Re: Clipboard parameter for button bars
Posted: 2024-10-10, 08:51 UTC
by browny
From cmd.exe window:
Code: Select all
c:\bin\wc>cd ..\%cd%
The filename, directory name, or volume label syntax is incorrect.
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?
Re: Clipboard parameter for button bars
Posted: 2024-10-10, 09:01 UTC
by Fla$her
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).
All variables are true, regardless of whether they are internal or system.
browny wrote: 2024-10-10, 08:40 UTC
Might mean, you are posting nonsense and messing up a very simple suggestion.
It wasn't a question for you. Are you unable to distinguish a rhetorical question from a direct one from the context?
Rough and unfounded assessments do not interest me.
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.
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.
Re: Clipboard parameter for button bars
Posted: 2024-11-04, 10:38 UTC
by ghisler(Author)
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?
Re: Clipboard parameter for button bars
Posted: 2024-11-04, 12:02 UTC
by funkymonk
Sounds great! A long awaited feature...
Thank you!
Re: Clipboard parameter for button bars
Posted: 2024-11-04, 14:02 UTC
by browny
This should cover many more cases than were expected initially.
Re: Clipboard parameter for button bars
Posted: 2024-11-04, 14:56 UTC
by Horst.Epp
Very nice, so I can remove Nirsoft form many buttons.