Skip to main content
Participating Frequently
Feb 4, 2025 6:53 PM UTC
Question

Add Range Selector in Text by Script

Good day.
Please tell me, I'm trying to write a script that will create a text layer and add a color animator there, so that I can change the color in certain words from a sentence, but every time I do this, I get a null error in the line of code where rangeSelector is used.

 

 

4 replies

Dan Ebberts
Community Expert
Community Expert
Feb 4, 2025 8:44 PM UTC

I think your "ADBE Text Selector Start" should be "ADBE Text Percent Start". That goes for the End parameter as well.

Translate
Participating Frequently
Feb 5, 2025 5:54 PM UTC

Yes, you are absolutely right. I wrote it incorrectly. Moreover, I need to manage it using indexes.
Despite the fact that I tried ADBE Text Persent Start and
ADBE Text index Start, it did not give me a result and returned null.
Using alert(rangeSelector.property(4).isModified); I found out that the properties are hidden and I do not know how to work with them.

Here is an example of my code.

var animator = textLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
    var rangeSelector = animator.property("ADBE Text Selectors").addProperty("ADBE Text Selector");
    var fillColor = animator.property("ADBE Text Animator Properties").addProperty("ADBE Text Fill Color");
    fillColor.setValue([1, 0, 0]);

rangeSelector.property(4).setValueAtTime(1, 6); 
rangeSelector.property(5).setValueAtTime(1, 12);
Translate
Participating Frequently
Feb 5, 2025 5:57 PM UTC

I also wanted to ask if there is any documentation on how to work with these or those parameters. Since my only source at the moment is GPT and it is not very reliable.

Translate
Kevin J. Monahan Jr.
Legend
Feb 4, 2025 8:29 PM UTC

Hello @valera_9213,

Thanks for the message. Since I'm not a scripting expert, is it possible to share the specific line of code where the error occurs, and I’ll share it with the devs. I hope it will help. Sorry for the frustration.

 

Cheers,
Kevin

 

Translate
Kevin Monahan - Sr. Community and Engagement Strategist – Adobe Pro Video and Audio