Skip to main content
Participant
March 18, 2011
Question

Align Text Left Scripting

  • March 18, 2011
  • 1 reply
  • 1846 views
I’m new to scripting with After Effects and I’m having troubles doing the simplest thing. I got most of my program to work just fine, however, when I used the built-in text replace function it changes my text from left aligned to center aligned. I need to set my text layer to left align again after the text it changed.


Can anyone please help me? I know this is very basic, I just can’t find anything in the scripting guide that will help.

My last resort option is to set the anchor point of the text field but I would rather just set the alignment.


Here is the replace function:


replaceTextInLayer(app.project.item(99).layer(8), "Original", "New")


I just want to left align this text layer.


app.project.item(99).layer(8)


Thanks in advance for your help!

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
March 18, 2011

Replacing text shouldn't affect the paragraph justification. I've never heard of the replaceTextInLayer() function. Is it possible that you inherited a script from someone and that function is defined somewhere in the code (or maybe in an include file)? In any case, control of justification came in with CS4 and you can see the details here:

http://blogs.adobe.com/toddkopriva/2008/12/after-effects-cs4-scripting-ch.html

Dan

nexter83Author
Participant
March 18, 2011

Dan, thank you for your quick response! That worked for me. I'm not sure why it changes - maybe something with the animation or anchor point. Anyway, the link you sent gave me the code I was looking for. Thanks!

Matt