Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Position Change Script

  • Position Change Script

    Posted by Ricky London on August 29, 2018 at 4:12 pm

    Hi Guys,

    Sorry if this has been asked before but I couldn’t find it.

    I am trying to write an if else statement for a 3 liner text box.

    I want the position of the text to change depending on how many lines of text e.g.

    if there is only 1 line of text it will drop down.
    if there is 2 lines it will drop down less.

    ( I was thinking maybe targeting the Character count (accounting for spaces) of each line of text and then when it reaches max position will change, but not sure how to write this with correct syntax. )

    max char line 1 = 10
    max char line 2 = 20
    if charcount(trim) = 10? , horizontal position – 10
    else if charcount = 20 , horizontal position – 5
    ?

    This is for a MOGRT if anyone is wondering why you would do this.

    Thanks,

    Cassius Marques replied 7 years, 11 months ago 2 Members · 5 Replies
  • 5 Replies
  • Cassius Marques

    August 29, 2018 at 5:52 pm

    count = 0;
    for (i=0; i < text.sourceText.length; i++)
    {
    if (text.sourceText[i] == '\r')
    {
    count++;
    }
    }
    value-[0,10*count]

    I’m Changing vertical position based on how many Enter keys you’ve got.

    Cassius Marques
    http://www.zapfilmes.com

  • Cassius Marques

    August 29, 2018 at 5:57 pm

    If you need it in an If/else format you can go like

    count = 0;
    for (i=0; i < text.sourceText.length; i++)
    {
    if (text.sourceText[i] == '\r')
    {
    count++;
    }
    }
    count == 2? value-[0,10] : (count == 1? value-[0,5]: value)

    You can then just type in the values for the position or do some math. (I’m supposing a 1-3 line text case)

    Cassius Marques
    http://www.zapfilmes.com

  • Ricky London

    August 30, 2018 at 10:18 am

    Hey Cassius,

    Thanks for this it’s great!

    just one small problem, as it’s for a mogrt there wont be any enter key presses allowed just the text bounding box will push the text to the next line, so would something like this work?

    if (text.sourceText[i] => 10(characters) )]

    Thanks,
    Ricky.

  • Ricky London

    August 30, 2018 at 11:00 am

    Actually after adding a line break in ae essentials source text it shows up in premeire as seperate lines the only problem is that the script does not translate to the premiere mogrt and lines do not move when deleted.. ( i don’t believe that it is reading the seperate lines as an enter keypress)

    can someone test this in premiere :

    add this to text position:

    count = 0;
    for (i=0; i < text.sourceText.length; i++)
    {
    if (text.sourceText[i] == ‘\r’)
    {
    count++;
    }
    }
    value-[0,90*count]

    then add 3 line breaks in the mogrt template and import it into premiere?

  • Cassius Marques

    August 30, 2018 at 7:04 pm

    yeah sorry, I’ve never used templates in Premiere, I never thought how would the interaction work nor how any changes would be evaluated. I’m an AE guy.

    Its up to you guys to build any remaining bridges.

    Cassius Marques
    http://www.zapfilmes.com

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