Dont Hate Me!
Hi all,
I am trying to use Chat GPT (dont hate me) to create a script which:
- Creates a Curves Adjustment Layer
Names the layer “CURVES_Contrast_YYYY-MM-DD”
with the date being added automatically.
Here is the JSX code:
// Photoshop Script - Curves Adjustment Layer with Date-Based Naming (No Grouping)
if (app.documents.length > 0) {
var doc = app.activeDocument;
function getFormattedDate() {
var date = new Date();
return date.getFullYear() + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + ("0" + date.getDate()).slice(-2);
}
var todayDate = getFormattedDate();
// Create the Curves adjustment layer using an Action Descriptor
var idMk = charIDToTypeID("Mk ");
var desc = new ActionDescriptor();
var idAdjL = charIDToTypeID("AdjL");
var ref = new ActionReference();
ref.putClass(idAdjL);
desc.putReference(charIDToTypeID("null"), ref);
var idUsng = charIDToTypeID("Usng");
var desc2 = new ActionDescriptor();
var idType = stringIDToTypeID("curves");
desc2.putClass(idType, idType);
desc.putObject(idUsng, idAdjL, desc2);
executeAction(idMk, desc, DialogModes.NO);
var newLayer = doc.activeLayer;
newLayer.name = "CURVES_Contrast_" + todayDate;
alert("Curves Adjustment Layer created!");
} else {
alert("No open document found.");
}
I get this error:
ChatGPT has tried multiple fixes and failed in the end. My intention is to create a script like this for each of the Adjustment Layers but so far I have failed at the first attempt.
Any suggestions for a non-coder?
Thanks
Sean
