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.
Solved [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
Moderators: Hacker, petermad, Stefan2, white
Solved [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
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.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
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 indicatepetermad 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.
- name without extension (!)
- extension only (+)
and then use usual substring numbering
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
Confirmed, that's indeed a bug. I will fix it.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.
Actually it is documented in Dialog box: Configuration - Change button bar, see the red part:The syntax is also quite ambigous and not so well documented in the help.
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
https://www.ghisler.com
Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
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) .
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) .
Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
Wll - i have updated it: https://www.ghisler.ch/board/viewtopic.php?f=6&t=57594I have to apologize as I'm using a dark version and it was not up to date...
That sounds til a nice feature to have +++it could be good to have a way to define no char limitation like :-~0,0 (complete name without extension) :-~0,-0(Complete extension)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: [TC 10.0] Parameter "%S:~-0,255" does not always work as ecpected
Confirmed fixed in TC 10.50b1histoty.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)

License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar