Page 1 of 1

Detect if layer is a text layer

Posted: August 13th, 2014, 10:55 am
by Iaenic
Hi everyone!

I'm trying to help someone write a script in the scripts request forum that selects layers with the same source footage. The problem i'm running into is that as it loops through the layers, if it runs into "text" it finds the source as null and breaks. Is there something I can do that would work something like this fictional example?

if (myComp.layer[y].source.istext == true ) { y++; }

Re: Detect if layer is a text layer

Posted: August 13th, 2014, 12:50 pm
by Iaenic
After further investigation, I managed to fix my problem.

I was trying to use this:
if (myComp.layers[y].source.name == null) { y++ }

instead of this:
if (myComp.layers[y].source == null) { y++ }

Newbie mistake, but at least I found it!

Re: Detect if layer is a text layer

Posted: August 14th, 2014, 3:38 pm
by Dan Ebberts
This should work too:

if (myComp.layers[y] instanceof TextLayer)


Dan