Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Scripting question: Change text layer size depending on text length

  • Scripting question: Change text layer size depending on text length

    Posted by C. blake Davis on January 23, 2018 at 5:04 pm

    Scripting question:

    I need a script that resizes a text layer depending on the length of the text.

    I’m already using a script that allows my text to auto update depending on the name of the comp ( compName = comp(” “).name; )
    What I need it to be able to change the comp name so it updates the text layer name, but resizes it depending on the length of the text.

    I’ve tried a few versions of the sourceRect but none seem to work.

    Any advice?

    Producer working in NorCal and Nashville

    Taso Mastorakis replied 8 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • Taso Mastorakis

    January 23, 2018 at 8:46 pm

    I’m not sure about updating the layer name but if you need something that resizes text to a size you can try this:

    w = (thisComp.width / thisLayer.sourceRectAtTime().width)*90;
    h = (thisComp.height / thisLayer.sourceRectAtTime().height)*90;
    if(w<100){
    [w,w];
    }else{
    [100,100];
    }

    Changing the width and height numbers in the first 2 lines will decide the scale of the text within a specific comp size. Hope this helps.

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