Copy link to clipboard
Copied
Currently I have two layers in an AI document.
Layer name = Custom1
Layer name = Custom2
In each one of these layers I have a specific text range with the contents
TEST1 and TEST2
Custom1 has TEST1 text and Custom2 has TEST2
How do I select the contents of the specific layer?
I can select the specific layer like so:
var aDoc = app.activeDocument;
aDoc.layers.getByName(layerName);
The only way I can get the text range contents is like so:
aDoc.activeLayer.textFrames[0].textRange.contents
But this is gives me the textFrames from the entire document so [0] in the index gives for the document not the layer.
How can I get the textRange.contents of a specific layer only?
var layerz = app.activeDocument.layers;
alert( layerz["Custom1"].textFrames[0].textRange.contents ); // TEST1
alert( layerz["Custom2"].textFrames[0].textRange.contents ); // TEST2
Copy link to clipboard
Copied
var layerz = app.activeDocument.layers;
alert( layerz["Custom1"].textFrames[0].textRange.contents ); // TEST1
alert( layerz["Custom2"].textFrames[0].textRange.contents ); // TEST2
Copy link to clipboard
Copied