Solved [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Solved [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Post by *petermad »

If I use a parameter in a button like: "%S:~-0,255" then the filename is returned without extension but ONLY if the file has an extension.

If the file has no extension, then the empty string is returned - I would still expect the file name without extension to be returned in that case.
Last edited by petermad on 2022-04-13, 20:45 UTC, edited 1 time in total.
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: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Post by *nsp »

petermad wrote: 2021-09-29, 20:15 UTC If I use a parameter in a button like: "%S:~-0,255" then the filename is returned without extension but ONLY if the file has an extension.

If the file has no extension, then the empty string is returned - I would still expect the file name without extension to be returned in that case.
The syntax is also quite ambigous and not so well documented in the help. instead of -0 as -1 have different behavior, it could have been easier to have optional char after the ~ to indicate
- name without extension (!)
- extension only (+)
and then use usual substring numbering
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Post by *ghisler(Author) »

If I use a parameter in a button like: "%S:~-0,255" then the filename is returned without extension but ONLY if the file has an extension.
Confirmed, that's indeed a bug. I will fix it.
The syntax is also quite ambigous and not so well documented in the help.
Actually it is documented in Dialog box: Configuration - Change button bar, see the red part:
Note: All parameters now support substring fields in the form :~start,length, e.g. %N:~2,5 or %N:~-8,5 . To append a number directly after the length value, use another ~ character, e.g. %N:~2,5~2. Negative vaules are measured from the end of the string. Example: %P:~0,-1 cuts off the backslash from the path.
The Start value -0 is special: %N:~-0,20 copies the first 20 characters of the name without extension, %N:~-0,-20 the first 20 characters of the extension without the name.
Author of Total Commander
https://www.ghisler.com
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Post by *nsp »

About the Help,
I have to apologize as I'm using a dark version and it was not up to date...
// This could be good to distribute dark version with TC if you can get the authorization or redo the same "css" work as it was done...

It is also very difficult to read as no empty lines are present before the subsections "Notes" / "Special parameters"and no carriage return for Notes :

About functionality, it could be good to have a way to define no char limitation like :-~0,0 (complete name without extension) :-~0,-0(Complete extension) .
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Post by *petermad »

I have to apologize as I'm using a dark version and it was not up to date...
Wll - i have updated it: https://www.ghisler.ch/board/viewtopic.php?f=6&t=57594
it could be good to have a way to define no char limitation like :-~0,0 (complete name without extension) :-~0,-0(Complete extension)
That sounds til a nice feature to have +++
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
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected

Post by *petermad »

histoty.txt wrote:01.10.21 Fixed: Button bar, start menu: Parameter to append characters just from file name, not extension (like %N:~-0,255 or %S:~-0,255) didn't work if file didn't have an extension (32/64)
Confirmed fixed in TC 10.50b1 :-)
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
Post Reply