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
Copy link to clipboard
Copied
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