• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Expression to count number of lines in a text layer

Community Beginner ,
Sep 22, 2024 Sep 22, 2024

Copy link to clipboard

Copied

Hello!

 

I would like to have an expression on a Menu Dropdown controller, such that if

var text = thisComp.layer("Verse").text.sourceText.value;

has 1 lines of text, then the dropdown menu will be value 1, if it has 2 lines the menu will be value 2, and if the text has 3 lines it will be value 3. (The default vaule of the dropdown menu should be value 2.)

 

Is there a way to do this, where you reference how many lines a text layer has with an expression?

 

Thanks!

TOPICS
Expressions , How to , Scripting

Views

93

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 22, 2024 Sep 22, 2024

Something like this maybe:

thisComp.layer("Verse").text.sourceText.split("\r").length

Votes

Translate

Translate
Community Expert ,
Sep 22, 2024 Sep 22, 2024

Copy link to clipboard

Copied

Something like this maybe:

thisComp.layer("Verse").text.sourceText.split("\r").length

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 22, 2024 Sep 22, 2024

Copy link to clipboard

Copied

LATEST

Works perfectly! Thanks so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines