check style of text layer through scripting

Community Beginner ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Hi,

 

is there a way to check if a text layer has only one style formatting in it through scripting?

 

As far as I know getStyleAt() works only with expressions, not in scripting right? Looking through scripting PDF and looking at TextDocument properties and methods it all works based only on first character of layer and i dont see any way to adress specific character in a way like getStyleAt() does in expressions, but for scripting.

 

The only way I can think of right now how to check it through scripting is to:

add a checkbox control to layer

set a expression to it to loop through individual characters with getStyleAt() and compare those

set its value through expression based on comparison

get the value of checkbox control through scripting 

delete the checkbox control

 

But this looks overcomplicated to me and I am not even sure if this would work, if there isnt some limitation I am not thinking of.

 

Isnt there a simpler way of doing this?

 

Thank you for help 

 

TOPICS
How to , Scripting

Views

21

Likes

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
Adobe Community Professional ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

LATEST

You basically figured it out already. It's inherent in how AE's source text works. For more complex stuff it's therefore simply more efficient to just have stuff separate or implement explicit controls in your script rather than hoping it may pick up an existing text.

 

Mylenium

Likes

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