Very long Title -> Filename

I have a track with very long title.
When I try to put the title to the filename with Tag - Filename, it brings a window,
which shows the long title and saying at the end:

If I know correctly, that's because there is a limit for a filename characters on Windows.

What I would like to do is this:

Tell Mp3tag, to put into the filename, as much characters as possible from the title.
Is this possible?


you can use the function $left(%artist%_%title%,20)
(where the contents of the brackets is just an example) to cut the filename to a specified length. In the example the length of the filename would be 20.
You can use the same function if you specify a fully qualified filename that includes the drive and path.
Then the 20 could be replaced by a 252.

Please note that this mechanism only truncates the string. So if the folder names are already that long that the length of 252 characters is reached then you do not get a valid filename or a rather weird one.
So you should have a look at the naming scheme and the result.

The limit is 255 characters for the entire path not just the filename, so you may have to reduce the directory/folder depth or shorten directory/folder names to accomplish this.

258 characters ... maximal length for the entire filepathname in the root folder of a disk.
259 characters ... maximal length for the entire filepathname in a subfolder of a disk.

Read also ...
what is maximum number of characters allowed in filename?

Yes, you can do it, using simple math functions from the Mp3tag scripting language.
You have to measure the entire length of the folderpath, then calculate the longest possible filename_ext.