how to check if layer is a text layer

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

jhexcore

how to check if layer is a text layer

Post by jhexcore »

var desc = new ActionDescriptor();
ref = new ActionReference();
ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
desc = executeActionGet(ref);

var layerName = desc.getString(charIDToTypeID( 'Nm ' ));
var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));

var layerType = typeIDToStringID(desc.getEnumerationValue(stringIDToTypeID( 'layerSection' )));
var isLayerSet =( layerType == 'layerSectionContent') ? false:true;

this part is to check if layer is a layerSet, how to check if layer is text layer??

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

pfaffenbichler

how to check if layer is a text layer

Post by pfaffenbichler »

If it’s just one Layer DOM code should do fine (app.activeDocument.activeLayer.kind) and the time factor should be negligible.
jhexcore

how to check if layer is a text layer

Post by jhexcore »

i just found out.

if(desc.hasKey(stringIDToTypeID('textKey')))

it will return true if layer is a text layer.