Detect if layer is a text layer

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Iaenic
Posts: 14
Joined: August 9th, 2012, 11:29 am

August 13th, 2014, 10:55 am

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++; }
Iaenic
Posts: 14
Joined: August 9th, 2012, 11:29 am

August 13th, 2014, 12:50 pm

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!
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

August 14th, 2014, 3:38 pm

This should work too:

if (myComp.layers[y] instanceof TextLayer)


Dan
Post Reply