extend script how to apply drop shadow to text layer
Hi, I tried google, chatGPT and Adobe docs to find out how to do it. Tried to debug with vscode and I can't find how to do it.
I mess too much the script, but I basically create a text layer with a string inside it.
This is chatGPT script that doesn't work:
// Reference to the active document
var docRef = app.activeDocument;
// Reference to the active layer
var layerRef = docRef.activeLayer;
// Ensure the layer is not a background layer
if (!layerRef.isBackgroundLayer) {
// Access the Drop Shadow effect
var dropShadow = layerRef.layerEffects.dropShadow;
// Enable the Drop Shadow effect
dropShadow.enabled = true;
// Customize the Drop Shadow properties
dropShadow.mode = BlendMode.MULTIPLY; // Set the blend mode (e.g., Multiply)
dropShadow.color = new SolidColor(); // Define the shadow color
dropShadow.color.rgb.hexValue = "000000"; // Set the color to black (#000000)
dropShadow.opacity = 75; // Set the opacity (0 to 100)
dropShadow.distance = 10; // Set the distance in pixels
dropShadow.size = 10; // Set the size in pixels
dropShadow.angle = 120; // Set the angle in degrees
dropShadow.useGlobalLight = true; // Use global light settings
// Notify the user that the style has been applied
alert("Drop Shadow has been applied to the active layer.");
} else {
alert("The active layer is a background layer and cannot have styles applied.");
}
Is there a way to do it in a script?
Thanks
