Copy link to clipboard
Copied
Is there a way for a script to get information about the currently existing layer styles on a layer?
For example, can I find out if a layer has a dropShadow, and if so, can I find that dropShadow's size, transparency, color, etc...?
If you don't have CS4 you will need Xbytor's script. With CS4 you can the the descriptor from the layer
var ref = new ActionReference();...
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('layerEffects'));
if( desc.hasKey( stringIDToTypeID('dropShadow') ) ){
desc = desc.getObjectValue(stringIDToTypeID('dropShadow'));
alert('opacity = '+ desc.getDouble( stringIDToTypeID('opacity') ) );
Copy link to clipboard
Copied
There is no easy way to get this information, but you can get to it.
Get my xtools library (from ps-scripts.sourceforge.net) and in there you will find xtools/xlib/Styles.js.
In there, you will find Styles.getLayerStyleDescriptor(). The will get you the ActionDescriptor that
describes the styles applied to a layer.
-X
Copy link to clipboard
Copied
haven't tried it out yet, but from a quick glance at it that looks like a really useful collection of tools - thanks for sharing!
Copy link to clipboard
Copied
If you don't have CS4 you will need Xbytor's script. With CS4 you can the the descriptor from the layer
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('layerEffects'));
if( desc.hasKey( stringIDToTypeID('dropShadow') ) ){
desc = desc.getObjectValue(stringIDToTypeID('dropShadow'));
alert('opacity = '+ desc.getDouble( stringIDToTypeID('opacity') ) );
alert('distance = '+ desc.getDouble( stringIDToTypeID('distance') ) );
alert('spread = '+ desc.getDouble( stringIDToTypeID('chokeMatte') ) );// spread
alert('blur = '+ desc.getDouble( stringIDToTypeID('blur') ) );
var desc = desc.getObjectValue(stringIDToTypeID('color'));
var r = desc.getDouble( stringIDToTypeID('red') ) ;
var g = desc.getDouble( stringIDToTypeID('green') ) ;
var b = desc.getDouble( stringIDToTypeID('blue') ) ;
alert( 'r = ' + r +'\rg = ' + g + '\rb = ' + b );
}
Copy link to clipboard
Copied
Sweet. That's even easier
Find more inspiration, events, and resources on the new Adobe Community
Explore Now