Help file: information about special parameters %C and %c

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Help file: information about special parameters %C and %c

Post by *DrShark »

edit: I removed the recommendation to use %c intead of %p%n (the rest of the post will be unchanged), because these commands indeed have a signifigcant difference in the way they work and additional actions are required to make such a replacement work in all cases. See new posts in the topic for updated information.

---

The Help page Dialog box: Configuration - Change button bar doesn't have the information that %C and %c commands without <number> parameter(s) insert a filename after cursor.
%C is exactly the same as %P%N.
%c is slightly different to %p%n because %c surrounds the short path with quotes if the path has a space (this happens if our file under cursor with a space in the name is a secondary hardlink so Windows doesn't return a short version of its name). %p%n doesn't surround the name with the quotes in mentioned case.

2ghisler(Author)
Please consider to add mentioned info about %C and %c special parameters to the Change button bar page of the Help file.
Last edited by DrShark on 2018-05-05, 07:37 UTC, edited 3 times in total.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If there are selected files, %C inserts first selected file path... So it seems that %C works like %C1.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

MVV wrote:If there are selected files, %C inserts first selected file path... So it seems that %C works like %C1.
You are right, thanks for correction! Would be nice to see this information added to a Help file.

It's still possible to use %c as a %p%n replacement after converting a button that use it to a em_ command and adding a cm_ClearAll command before (and cm_RestoreSelection after) it.
My suggestion then, to avoid this workaround, is for %p%n parameter to add a quotes surrounding of a short path with file name with a space, like this one:
C:\temp\HARDLI~1\longname file secondary hardlink.ext
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Again, %c works just like %C but with short DOS names, it is not a %p%n replacement (behaviour differs when there is a selection). I don't think that using hacks like cm_ClearAll+cm_RestoreSelection is a good idea (in case of large selection it will be much faster to use another parameters).
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

MVV wrote:Again, %c works just like %C but with short DOS names, it is not a %p%n replacement
Yes, and I didn't know that when was writing the first post here (because I didn't test %c and %C good enough and Help page wasn't clear about these parameters). So my on-topic suggestion to add the info in Help about %C and %c when numbers aren't added to them is still valid.
MVV wrote:I don't think that using hacks like cm_ClearAll+cm_RestoreSelection is a good idea (in case of large selection it will be much faster to use another parameters).
That's why I added an off-topic suggestion about quotes for %p%n when there's space present in a long file name. As of now however that "hack" to use %c and the mentioned cm commands as a %p%n replacement is the only native solution.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can use "%P%O.%E" if you need stable quoting. Quoting controlling question was discussed a long ago but with no luck.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

DrShark wrote:%c is slightly different to %p%n because %c surrounds the short path with quotes if the path has a space (this happens if our file under cursor with a space in the name is a secondary hardlink so Windows doesn't return a short version of its name). %p%n doesn't surround the name with the quotes in mentioned case.
hostory920.txt wrote:16.04.18 Added: Button bar, start menu: Add quotes around name inserted with %p%n too if it contains spaces or '&' character (32/64)
Thanks, now secondary hard links with spaces are surrounded by quotes for %p%n. I didn't test it, but I guess it should also work for all filenames if 8.3 names generation disabled on system level.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply