Skip navigation
CenekStrichel
Currently Being Moderated

Get number of lines by expression

Jan 7, 2013 6:59 AM

Hello I can easily find number of characters in text by text.sourceText.length; command. But I need number of lines. Is it possible? I can not find any documentation about text.sourceText. next parametrs. It will inherited from javascript I think.

 

Thanks

 
Replies
  • Currently Being Moderated
    Jan 7, 2013 1:42 PM   in reply to CenekStrichel

    The hard way would be to count the line breaks in a loop, the simple way would be to apply a text selector with mode set to lines and link the Start/End values to wherever you need them...

     

    Mylenium

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 8, 2013 7:47 AM   in reply to CenekStrichel

    Set the mode to Index and the End value will reflect the number of lines.

     

    Mylenium

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 8, 2013 7:47 AM   in reply to CenekStrichel

    if you use it as and expression on the sourceText of the layer with the text : value.split(/\n|\r/).length

     

    on a different layer targeting a text layer called myTextLayer : thisComp.layer("myTextLayer").text.sourceText.split(/\n|\r/).length

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 10, 2013 8:18 AM   in reply to CenekStrichel

    There is no way to do this with expressions. Only scripts can read area text shape size and other font properties, but even then you need to input some values into your formula manually, because naturally the visible content of a font is different from the em box of the letters and other specifics like glyph substitution, custom baseline settings and whatnot may matter.

     

    Mylenium

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points