Copy link to clipboard
Copied
Photoshop version:
26.0.0
Error:
Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- The command “Set” is not currently available.
Line: 60
-> executeAction(charIDToTypeID("setd"), desc, DialogModes.NO);
What am I doing wrong when I execute the action? (sorry the comments are in Spanish)
#target photoshop
function applyGradientGrayOverlay() {
var doc = app.activeDocument;
// Ajusta estos valores según lo que prefieras
var startGray = 1; // Valor inicial de gris (0 = negro, 255 = blanco)
var increment = 1; // Incremento de gris por cada capa
// Iterar sobre cada capa
for (var i = 0; i < doc.layers.length; i++) {
var layer = doc.layers[i];
if (layer.typename == "ArtLayer" && !layer.isBackgroundLayer) {
// Calcular el valor de gris para esta iteración
var grayValue = Math.min(255, startGray + (i * increment));
// Crear el color gris
var color = new SolidColor();
color.rgb.red = grayValue;
color.rgb.green = grayValue;
color.rgb.blue = grayValue;
// Aplicar el Color Overlay a la capa
addColorOverlay(layer, color);
}
}
}
function addColorOverlay(layer, color) {
// Seleccionar la capa
app.activeDocument.activeLayer = layer;
// Crear el descriptor para el estilo de capa de Color Overlay
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lefx"), charIDToTypeID("Lyr "), charIDToTypeID("Ordn"));
desc.putReference(charIDToTypeID("null"), ref);
// Configuración de la superposición de color (Color Overlay)
var fxDesc = new ActionDescriptor();
var overlayDesc = new ActionDescriptor();
overlayDesc.putBoolean(charIDToTypeID("enab"), true); // Habilitar
overlayDesc.putEnumerated(charIDToTypeID("Md "), charIDToTypeID("Blnd"), charIDToTypeID("Nrml")); // Modo de fusión: Normal
overlayDesc.putUnitDouble(charIDToTypeID("Opct"), charIDToTypeID("#Prc"), 100); // Opacidad al 100%
// Configurar el color
var colorDesc = new ActionDescriptor();
colorDesc.putDouble(charIDToTypeID("Rd "), color.rgb.red);
colorDesc.putDouble(charIDToTypeID("Grn "), color.rgb.green);
colorDesc.putDouble(charIDToTypeID("Bl "), color.rgb.blue);
overlayDesc.putObject(charIDToTypeID("Clr "), charIDToTypeID("RGBC"), colorDesc);
// Agregar la configuración de Color Overlay al descriptor del efecto
fxDesc.putObject(charIDToTypeID("SoFi"), charIDToTypeID("SoFi"), overlayDesc);
desc.putObject(charIDToTypeID("T "), charIDToTypeID("Lefx"), fxDesc);
// Aplicar el descriptor a la capa activa
executeAction(charIDToTypeID("setd"), desc, DialogModes.NO);
}
// Ejecutar la función
applyGradientGrayOverlay();
Copy link to clipboard
Copied
I looked at the code, but I couldn't debug the error. Can you post screenshots of the two required layer style's values/settings?
Copy link to clipboard
Copied
Hey! You might be running into an issue where the tool you need is not available. Please check out this post: https://adobe.ly/3NR1evQ;
Let us know if this helps. 🙂
^CM
Find more inspiration, events, and resources on the new Adobe Community
Explore Now