The solution you gave works fine in single folder but fail in BranchView as in %S the path (from base folder) is prefixed and the :~-0,nnn syntax keep it part of the name.
Yes, that is a limitation of the SELECTFILES command - it only works with filenames without path.
...just found it in history and not in help as no substring section have been made in the index
It is in the help for Configuration - Change Button bar:
Here you can specify command line parameters. Fixed parameters must be specified directly after the file name, because otherwise, in a Drag&Drop, only the file name would be given to the program.
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.
255 chars could also be short fo some filename but works for 99.99% of the time
Remember it is only file name, not full path - so I think 255 will suffice in 99.99% of the cases as you write.
I made a bug/missing feature rapport about the ~-0 parameter substring, that it returns an empty string if there is no file extension: https://www.ghisler.ch/board/viewtopic.php?p=405873