I've been trying to figure out how to add text to an indexed image but I get the error: "The command MAKE is not currently available". I get this on the line: var newLayerRef = activeDocument.artLayers.add();
I am able to get it work using JavascriptListener but it sets every single variable available and I really just want a basic command sequence.
Any thoughts or ideas would be appreciated!
Thanks.
Text on an indexed image?
Text on an indexed image?
Try using this function, see if it works.
Code: Select all function addTextLayer(layerName,text)
{
var thisLayer = activeDocument.artLayers.add();
thisLayer.kind = LayerKind.TEXT;
thisLayer.name = layerName;
var textProperty = thisLayer.textItem;
textProperty.size = 10;
textProperty.font = "Arial";
var newColor = new SolidColor();
newColor.rgb.red = 0;
newColor.rgb.green = 0;
newColor.rgb.blue = 0;
textProperty.color = newColor;
textProperty.position = new Array( 20,20);
thisLayer.blendMode = BlendMode.NORMAL;
thisLayer.opacity = 100;
textProperty.contents = text;
}
addTextLayer('test layer','test add text')
Andrew
Code: Select all function addTextLayer(layerName,text)
{
var thisLayer = activeDocument.artLayers.add();
thisLayer.kind = LayerKind.TEXT;
thisLayer.name = layerName;
var textProperty = thisLayer.textItem;
textProperty.size = 10;
textProperty.font = "Arial";
var newColor = new SolidColor();
newColor.rgb.red = 0;
newColor.rgb.green = 0;
newColor.rgb.blue = 0;
textProperty.color = newColor;
textProperty.position = new Array( 20,20);
thisLayer.blendMode = BlendMode.NORMAL;
thisLayer.opacity = 100;
textProperty.contents = text;
}
addTextLayer('test layer','test add text')
Andrew
Text on an indexed image?
Thanks for the reply! I copied your code and tried it out. I get the same error...make unavailable.
I probably should have mentioned earlier that I'm on PS7. That may not matter, but then again...they have done some very impressive scripting updates since this version.
I probably should have mentioned earlier that I'm on PS7. That may not matter, but then again...they have done some very impressive scripting updates since this version.