Error Using $cutright, $mid, $left with $len

mp3tag-len-error-18-06-2023 14-43-15


mp3tag-left-len-error-18-06-2023 14-17-58
mp3tag-left-len-error-18-06-2023 14-12-51

the fix is simple enough logically - i simply wanted too truncate the Title by 65 chars ie removethe last chars of title

  1. of course with data like this the Title length ie $len is totally variable so no fixed parameters can be used
  2. there is no simple $truncate function
  3. NONE of $left, $mid, or $cutright would work with $len to remove the last 6 chars
    see various attached examples
  4. if i used $len with another PH, eg Artist, it worked, ie, if i wanted, i could truncate the Title by the length of the Artist field, which is fine - if you want to do that
  5. but if you want to take a fixed number of the length to KEEp ie in this case Title Length - 6, no combination would work
  6. it just didn't do anything, ie THIS is what would not work ... eg %title, $len(%title)-6. as per attachments, no matter which function i used
  7. as i think i might have said before, a $TRUNC(x,n or field) function would be so much eaisr

PS i find i have to be ultra careful because i am using MP3Tag and AIMP Tag Edfitor and Bulk Rename Utility, simultaneously, and the PH and functions are very similar - but different. very easy to get them mixed up when using
, the '-6' would not work
.

To subtract values, use $sub()
See the documentation:

1 Like

You write in the topic title, that $cutright does not work for you.

If I try it with your mentioned track title
Twenty Tiny Fingers (Alma Cogan) (The Fabulous Fifties - Thest of the Fab 50s) (2005) (144kbits)158453

I get this in the preview of Convert Tag->Tag
image
Why should this not work for you?

From the already linked documentation:

If you want to solve it with an Action, you could try "Format value":
image


If you need to cut a variable number of characters with the length of ARTIST, this would work too:
(this example assumes, that the current content of ARTIST has 6 characters)
image

1 Like

Usually, a TRUNC function only returns a number truncated to a specified number of digits.
It is not applicable to text in most variants.

The $cutRight(x,n) and $cutLeft(x,n) scripting functions of Mp3tag does exactly what you are looking for:
Removing the last or first n characters of the string x = returning the "truncated" string

1 Like

this might help me.

let me check. i have tried sooo many variations ...

now on this ppint, i was trying something, but was apparently stymied because it didn't take a PH variable .... let me find that to show you,
and so the next thing was how to achieve the desired result without using a PH directly...

i will come back and paste image

image

so what do you do instead?

Please don't cross-post!
(You have already asked the same in this thread)

Use an action "Format value" to rename your track filenames.
Don't use "Replace" as @poster already told you.

Use a format string with something like this:
$num(%TRACK%,2). $cutRight(%ARTIST%,9) - %TITLE%


This would result in a filename like:
01. Abba - Waterloo.mp3

Or just reduce the format string to your example
%ARTIST%
if you only want to see the full content of ARTIST as your new track filename.
For my above example this would result in this trackname:
Abba and more.mp3