Add Range Selector in Text by Script
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I think your "ADBE Text Selector Start" should be "ADBE Text Percent Start". That goes for the End parameter as well.
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
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.

