Limit ID tag if Char is "greater than"

I have a Clarion AutoPC that plays MP3s and it has a limited non scrolling title show feature from the ID tags. I want to limit the chars in the artist and title fields for my unique MP3 that I use in that system.

So I am using this:

Format Value: Title
Value: $left(%title%,18)..

As you an see it cuts the title at 18 chars from the left, but it also adds the ".." I want to show truncation on the display, but I am looking to add some intelligence so that the ..'s are not added unless the file was actually truncated.

Some files don't need the truncation, so I'm looking to crop at 18 and add .. for 20 chars total without a space after the last char.

Anyone have a thought on how to best achieve this as an Action?

Best,
Chris

Perhaps you find inspiration in this thread:

/t/16455/1

e.g.
$ifgreater($len(%title%),18,$left(%title%,18)..,%title%)

Following your idea, I came up with:

$iflonger(%title%, 18, $left(%title%,18)..,%title% )

The only issue I'm seeing now is that I'm getting a leading white space at the beginning of the char and white space at the end.

Not sure why it's adding the white space. What am I doing wrong?

TY



The blank in front of the $left() is taken as an literal character.
The blank in front of the ) after %title% is taken as a literal character.

See what the expression in post #2 does for you.

TY!

Ok, so now when I remove the literal spaces the ".." are having a single white space added between the cropped title just before the appended ..

So instead of:

"PINK COOKIES IN A.."

I'm getting:

"PINK COOKIES IN A .."

Please show us the exact expression that you use.
(Or: did you try the expression in post #2?)

I copied and pasted the string you posted in #2

$ifgreater($len(%title%),18,$left(%title%,18)..,%title%)

I found it's not an issue with the script, the last space is actually the 18th character. I'll look to see if the $trimRight can help fix this issue.

Here is my final fix that what works for my needs.

$ifgreater($len(%title%),18,$trimRight($left(%title%,18))..,%title%)
$ifgreater($len(%artist%),10,$trimRight($left(%artist%,10))..,%artist%)

Thanks for all your help.