Skip to main content
Inspiring
March 10, 2025
Answered

This functionality may not be available in this version of Photoshop Error. no additional informatio

  • March 10, 2025
  • 1 reply
  • 210 views

When I use a script to get text layer information, this line of code colorDesc.getDouble(stringIDToTypeID('red')) throws an error: 

This functionality may not be available in this version of Photoshop Error. no additional information available

function get_layer_text_info() {

var ref = new ActionReference();

ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));

var layerDesc = executeActionGet(ref);
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));

var layerStyles = textDesc.getList(stringIDToTypeID('textStyleRange'));

var textContents = textDesc.getString(stringIDToTypeID('textKey'));
var textInfoList = [];


alert("layerStyles.count:" + layerStyles.count)


for (var i = 0; i < layerStyles.count; i++) {

var textStyleRange = layerStyles.getObjectValue(i);

var from = textStyleRange.getInteger(stringIDToTypeID('from'));

var to = textStyleRange.getInteger(stringIDToTypeID('to'));


var textStyle = textStyleRange.getObjectValue(stringIDToTypeID('textStyle'));


var color;
if (textStyle.hasKey(stringIDToTypeID("color"))) {


var colorDesc = textStyle.getObjectValue(stringIDToTypeID('color'));

alert("test" )

var red = colorDesc.getDouble(stringIDToTypeID('red'));
var green = colorDesc.getDouble(stringIDToTypeID('green'));
var blue = colorDesc.getDouble(stringIDToTypeID('blue'));
color = red + "," + green + "," + blue;
} else {
color = null;
}

}

Correct answer javaer

The reason has been found, it's because some keys do not exist.For example, red and size.

1 reply

c.pfaffenbichler
Community Expert
Community Expert
March 10, 2025

Please provide the file for testing. 

javaerAuthorCorrect answer
Inspiring
March 13, 2025

The reason has been found, it's because some keys do not exist.For example, red and size.