Problems with %$CLIPBOARD0% and %$CLIPNAME1%

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

But then it doesn't follow the logic of CLIPNAME*
The idea of CLIPNAME is to filter out invalid characters, and to remove leading and trailing spaces. It's not limited to names.
The point is directly in the need for quotation marks.
No, what you request is that I remove quotation marks. %P never removes anything from the actual path.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

The idea of CLIPNAME is to filter out invalid characters, and to remove leading and trailing spaces. It's not limited to names.
If such an idea was originally there, then the name should be appropriate, i.e. not with "NAME".

Okay. Then, to solve the problem itself, I can suggest an alternative: regardless of the use of certain variables, replace all double quotes in the result commands (including the "Command:" field) with single quotes. Can you do it? For example, by adding the %Q1 parameter (вut this should also apply to the entry in the first field).
Overquoting is evil! 👎
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

TC 11.50RC1
Repeat item 2, it outputs [ FileName " File Name 2"] instead of [FileName "FileName 2" "File Name 3"].
If all variables are enclosed in quotation marks, then: "" "FileName" "" File Name 2"" (or "" "FileName" " File Name 2" for _NE)
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

Sorry, I'm at release candidate 1 now, which means no more new features. Parameters like %S or %P%S always surrounded just files with spaces in them with quotes, not all files, so why is this suddenly a problem?
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

I didn't understand, which post were you responding to now?
My last post is about bugs, not new features.
Parameters like %S or %P%S always surrounded just files with spaces in them with quotes
"%S" doesn't add extra quotes to names if there are spaces.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

???
Of course %S adds quotes to names with spaces.

Just add a button with parameter
?%S
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

I wrote "%S" and extra quotes, not %S and quotes.

You didn't answer the question. Are you confirming the bug?
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

I wrote "%S" and extra quotes, not %S and quotes.
Why did you do that? %S already adds quotes by itself.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

I didn't do it, you did it:
14.01.19 Added: Button bar, parameters "%S", "%R", "%P%S", "%T%R": Surround all names with quotes when user puts parameter in quotes, e.g. "%S" -> "name1" "name2" (32/64)
cmd.exe /q/c for /f in
("%S") do if %%f neq "Name" ...
equivalent to
(%S) do if "%%~f" neq "Name" ...

There may also be apostrophes in the name, which some programs interpret as quotation marks.

In any case, this is only indirectly related to the described bug with an unnecessary empty first value, extra spaces in front and the absence of a third value.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

This was a special addition for %S etc. because otherwise it would result in "name1 name2 name3" instead of "name1" "name2" "name3". No such problem with %$CLIPNAME1% because it only contains one name.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

Quantity doesn't matter here, you can specify several variables with a number if necessary. The speech is about suppressing the doubling of quotation marks when there are spaces in names.
If this didn't happen with "%S", then the list would be returned as follows: "FileName1" ""File Name 1"" ""File Name 2""
The same is required here when quotes are already present on the clipboard.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

How about modifying the Q suffix, e.g. uppercase Q=only surround with quotes when needed, lowercase q=always surround with quotes? This would have the advantage that it would also work in other places where environment variables are used, not just in the "parameters" field like "%S".
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

Of course, the variable must work from any field, and that's what I wrote about.
But I don't really understand how exactly this will work? Like this? >

%CLIPNAME_NEQ%
File > File
"File > File
File" > File
"File" > "File"
File name > "File Name"
"File name" > "File Name"
" C:\Path\To " > ?

%CLIPNAME_NEq%
File > "File"
"File > ""File"
File" > "File""
"File" > ""File""
File Name > "File Name"
"File name" > ""File Name""
" C:\Path\To " > "" C:\Path\To ""

Please write your options on the right.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *ghisler(Author) »

No, when there are already double quotes at the start end end, they wouldn't be doubled with %CLIPNAME_NEq%, the same as with %CLIPNAME_NEQ%. The only difference would be with names without quotes:

Code: Select all

%CLIPNAME_NEq%
File > "File"
"File > "File"
File" > "File"
"File" > "File"
File Name > "File Name"
"File name" > "File Name"
" C:\Path\To " > " C:\Path\To "
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Problems with %$CLIPBOARD0% and %$CLIPNAME1%

Post by *Fla$her »

Good! Can't spaces/tabs be removed near quotation marks?
" C:\Path\To " > "C:\Path\To"
Overquoting is evil! 👎
Post Reply