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

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

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: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

This should work too:

if (myComp.layers[y] instanceof TextLayer)


Dan
Post Reply