I don’t think there’s a built-in function for that. If you’re using a consistent font size, I have a method that may help.
Create a slider control determines how tall your text box is:
s=thisComp.layer(“Text Layer Name”);
s.sourceRectAtTime().height;
Make another slider that divides that value by your font point to get the number of lines in the paragraph (in this case I used 13 for a 12.5 font point):
Math.ceil((effect(“Height slider”)(“Slider”))/13)
Make another slider to set the initial Y value of your text box: (no expression)
Make another slider for the change in your Y value:
effect(“Number of lines slider”)(“Slider”)*13
Finally, set this expression for your text box’s position:
temp = transform.position[0];
[temp, thisComp.layer(“Text Layer Name”).effect(“Initial Y Value”)(“Slider”)-thisComp.layer(“Text Layer Name”).effect(“Change in Y Value”)(“Slider”)]
This should make it so your text box moves up as you add lines, so the bottom of the text box stays in the same position.