Brennan_McTernan@adobeforums.com wrote:
> I'm stuck on getting at the drop shadow effect on a layer. I'd like to be able to read and output whether a drop shadow is being used, and if it is being used, the angle and distance of the drop shadow.
Unless I'm reading my xml wrong, it should be something close to this:
cTID = function(s) { return app.charIDToTypeID(s); };
// returns the ActionDescriptor for the active layer of the active doc
function getLayerDescriptor() {
var ref = new ActionReference();
ref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
return executeActionGet(ref)
};
// returns the ActionDescriptor for the layer style of the active layer
// of the active doc
function getLayerStyleDescriptor() {
var desc = getLayerDescriptor();
return desc.hasKey(cTID('Lefx')) ?
desc.getObjectValue(cTID('Lefx') : undefined;
};
var ldesc = getLayerStyleDescriptor();
if (ldesc) {
// Get the drop shadow descriptor if there is one.
var drSh = ldesc.hasKey(cTID('DrSh')) ?
ldesc.getObjectValue(cTID('DrSh') : undefined;
if (drSh) {
var angle = drSh.getUnitDoubleValue(cTID('lagl'));
var angleType = drSh.getUnitDoubleType(cTID('lagl'));
var dist = drSh.getUnitDoubleValue(cTID('Dstn'));
var distType = drSh.getUnitDoubleType(cTID('Dstn'));
}
}
-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com