Code: Select all
docRef.layers.length
However, trying to extract the color of a layer inside the artboard, for example, with the code below will generate an error:
Code: Select all
function getFillColor(){
var ref = new ActionReference();
ref.putEnumerated( stringIDToTypeID( "contentLayer" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));
var ref1= executeActionGet( ref );
var list = ref1.getList( charIDToTypeID( "Adjs" ) ) ;
var solidColorLayer = list.getObjectValue(0);
var color = solidColorLayer.getObjectValue(charIDToTypeID('Clr '));
var fillcolor = new SolidColor;
fillcolor.rgb.red = color.getDouble(charIDToTypeID('Rd '));
fillcolor.rgb.green = color.getDouble(charIDToTypeID('Grn '));
fillcolor.rgb.blue = color.getDouble(charIDToTypeID('Bl '));
return fillcolor.rgb.hexValue;
};
Code: Select all
var ref1= executeActionGet( ref );
Any ideas?
Thanks,
Alex