Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to clamp the text length and add “…” to the end if over value

  • Expression to clamp the text length and add “…” to the end if over value

  • Shane Starnes

    February 27, 2023 at 9:57 pm

    Hey guys, I’m working on a project that will take input from various users for the same project. Some of these users may use text that will extend beyond the visual bounds of the text field, and I’d like to stop it from moving/scaling beyond that field, and also add “…” to the end to keep it visually appealing. Automatic scaling with sourceRecAtTime is not an option here. Here’s the expression I’ve used so far on the Source Text Property:


    if (text.sourceText.length >= 35){

    text.sourceText + “…”;};


    It adds the ellipsis where it should be, but doesn’t clamp the text length. I’m stumped. Any ideas?

  • Dan Ebberts

    February 27, 2023 at 10:19 pm

    Something like this:

    txt = text.sourceText.value;
    if (txt.length > 36)
    txt.substr(0,35) + "..."
  • Shane Starnes

    March 14, 2023 at 9:29 pm

    Hi Dan,

    Thank you for your response, and I apologize for my late reply. This works perfectly for my use case. So happy to have received your input on this matter. You’re a legend! 😃

    Regards, Shane

  • Brie Clayton

    March 15, 2023 at 2:30 pm

    Thanks Shane, another Solve for Dan Ebberts.

Viewing 1 - 4 of 4 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy