P: Setting firstLineIndent with Javascript not working
I have a javascript-program that worked in 2014 for adding text given in a text file to images as captions. Today I wanted to reuse it with Photoshop 21.1.1 and it ran almost succesfully. Only setting the indent for the created Text Item with the "firstLineIndent"-property is not taken; it is always 0, but no errors are shown.
textItemRef.firstLineIndent = 32;
...does not change that setting to 32 and does not throw an error.
JJMack thankfully tested the following script:
// Create Image with 1382 x 787 Pixel<br>app.preferences.rulerUnits = Units.PIXELS;
app.documents.add(1382, 787, 300, "Image Caption", NewDocumentMode.RGB);
createText("Caption", "Calibri", 8.0, 0, 0, 0, "Description Text", 5, 179, 324, 14, Justification.LEFT, 32, 0);function createText(lname, fface, size, colR, colG, colB, content, tX, tY, wdth, hght, just, indent, rot) {// Add a new layer in the new document<br>var artLayerRef = app.activeDocument.artLayers.add();<br>artLayerRef.name = lname;<br>// Specify that the layer is a text layer<br>artLayerRef.kind = LayerKind.TEXT;<br>artLayerRef.rotate(rot);//This section defines the color of the text<br>textColor = new SolidColor();<br>textColor.rgb.red = colR;<br>textColor.rgb.green = colG;<br>textColor.rgb.blue = colB;//Get a reference to the text item so that we can add the text and format it a bit<br>textItemRef = artLayerRef.textItem;<br>textItemRef.kind = TextType.PARAGRAPHTEXT;<br>textItemRef.font = fface;<br>textItemRef.color = textColor;<br>textItemRef.size = size;textItemRef.position = new Array(tX, tY); //pixels from the left, pixels from the top<br>textItemRef.width = wdth;<br>textItemRef.height = hght;textItemRef.justification = just;<br>alert("textItemRef.firstLineIndent=" + textItemRef.firstLineIndent);<br>textItemRef.firstLineIndent = indent;<br>alert("indent=" + indent + " textItemRef.firstLineIndent=" + textItemRef.firstLineIndent);textItemRef.contents = content;<br>}
- It worked in CS6 Creative Cloud version 13.1.2 and CS3
- It does not work in CC 2014, CC 2018, CC 2019 or PS 2020
