
Stephen Marsh
Community Expert
Stephen Marsh
Community Expert
Activity
2 hours ago
@seans94943058
The block of code to create the curves adjustment layer is using Action Manager (AM) code. AM code can sometimes be specific to a certain Photoshop version, otherwise it's just a problem with the AI code.
If you wish to make this for each adjustment layer kind, you need to download and install Adobe's ScriptingListener plugin (if it works with your version), or do this with the built-in or third-party UXP developer tools, using AI will probably be hit and miss.
Here is your code updated and tested in v2021:
// Photoshop Script - Curves Adjustment Layer with Date-Based Naming (No Grouping)
try {
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 idmake = stringIDToTypeID("make");
var desc179 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref2 = new ActionReference();
var idadjustmentLayer = stringIDToTypeID("adjustmentLayer");
ref2.putClass(idadjustmentLayer);
desc179.putReference(idnull, ref2);
var idusing = stringIDToTypeID("using");
var desc180 = new ActionDescriptor();
var idtype = stringIDToTypeID("type");
var desc181 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID("presetKind");
var idpresetKindType = stringIDToTypeID("presetKindType");
var idpresetKindDefault = stringIDToTypeID("presetKindDefault");
desc181.putEnumerated(idpresetKind, idpresetKindType, idpresetKindDefault);
var idcurves = stringIDToTypeID("curves");
desc180.putObject(idtype, idcurves, desc181);
var idadjustmentLayer = stringIDToTypeID("adjustmentLayer");
desc179.putObject(idusing, idadjustmentLayer, desc180);
executeAction(idmake, desc179, DialogModes.NO);
var newLayer = doc.activeLayer;
newLayer.name = "CURVES_Contrast_" + todayDate;
alert("Curves Adjustment Layer created!");
} else {
alert("No open document found.");
}
} catch (e) {
alert("Error: " + e);
}
... View more
3 hours ago
@cody_1793 – I also consider this a bug, the file can only be one of three orientations at a time: Portrait, Landscape or Square.
Bug reports are still handled at a separate site for Bridge (requiring a separate user account):
https://adobebridge.uservoice.com/forums/905377-report-bugs
@ExUSA – Thank you for posting a scripted solution!
... View more
3 hours ago
Thanks, Stephen, this is much help. I'll troubleshoot it further.
By @code_seeeeeker
You're welcome! Try this, it alerts all layers and also writes to a log text file on the desktop.
Modifications could be made to only report on the Illustrator smart object layers that don't match the document colour mode.
/*
Check all vector smart objects for RGB or CMYK mode.jsx
Stephen Marsh
v1.0 - 11th March 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/smartobject-in-photoshop/td-p/15195068
Info: Saves the color mode of all vector smart object layers to a text file on the desktop
*/
#target photoshop
// Check if there is an active document
if (app.documents.length > 0) {
// Single history stage undo
app.activeDocument.suspendHistory("Undo Script", "main()");
function main() {
// Set the variables
var doc = app.activeDocument;
var docName = doc.name
var colorMode = doc.mode;
var docColorMode = "Document Color Mode = ";
// Determine the document color mode
switch (colorMode) {
case DocumentMode.GRAYSCALE:
docColorMode += "Grayscale";
break;
case DocumentMode.RGB:
docColorMode += "RGB";
break;
case DocumentMode.CMYK:
docColorMode += "CMYK";
break;
case DocumentMode.LAB:
docColorMode += "Lab";
break;
}
// Array to store the layer information
var layerInfo = [];
// Traverse all layers in the document
traverseLayers(app.activeDocument, layerInfo);
// Output the layer information to an alert
if (layerInfo.length > 0) {
alert("Info:" + "\r" + docColorMode + "\r\r" + layerInfo.join("\r\r"));
} else {
alert("Info:" + "\r" + docColorMode + "\r\r" + "No vector smart object layers found!");
}
// Output the layer information to a text file
var outputText = docName + "\r\r" + docColorMode + "\r\r";
if (layerInfo.length > 0) {
outputText += layerInfo.join("\r\r");
} else {
outputText += "No vector smart object layers found!";
}
writeToFile(outputText, "~/Desktop/SmartObjectInfo.txt");
}
} else {
alert("A file must be open to run this script!");
}
// End of script notification
alert("A text file 'SmartObjectInfo.txt' has been saved to the desktop with the color mode of all Adobe Illustrator smart object layers.");
///// Functions /////
function traverseLayers(parent, layerInfo) {
for (var i = 0; i < parent.artLayers.length; i++) {
processLayer(parent.artLayers[i], layerInfo);
}
for (var j = 0; j < parent.layerSets.length; j++) {
traverseLayers(parent.layerSets[j], layerInfo);
}
}
function processLayer(layer, layerInfo) {
if (layer.kind == LayerKind.SMARTOBJECT) {
var mySO = getSmartObjectName(layer);
if (mySO.found && /\.ai$/.test(mySO.fileRef)) {
// Convert the vector smart object to a linked PDF file to check the color mode
placedLayerConvertToLinked(layer, "~/Desktop/_temp-VectorToDelete.pdf");
// Undo the action to revert the vector smart object
executeAction(charIDToTypeID("undo"), undefined, DialogModes.NO);
// Set the path to the temporary vector file
var tempVectorFile = File("~/Desktop/_temp-VectorToDelete.pdf");
// Read the binary data of the temporary vector file
if (tempVectorFile) {
var binaryData = readBinaryFile(tempVectorFile);
if (binaryData !== null) {
var searchString = "_ColorModel: 1"; // %AI9_ColorModel: 2 for CMYK
var found = searchInBinaryData(binaryData, searchString);
if (found) {
layerInfo.push("Layer Name = " + layer.name + "\rSmart Object Color Mode = RGB");
} else {
layerInfo.push("Layer Name = " + layer.name + "\rSmart Object Color Mode = CMYK");
}
}
}
// Delete the temporary vector file
tempVectorFile.remove();
}
}
}
function writeToFile(content, filePath) {
var file = new File(filePath);
file.open("w");
file.encoding = "UTF8";
file.write(content);
file.close();
}
function getSmartObjectName(layer) {
try {
var smartObject = {
found: false,
fileRef: '',
linked: false,
};
var ref = new ActionReference();
ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
ref.putIdentifier(charIDToTypeID("Lyr "), layer.id);
var so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));
smartObject.found = true;
smartObject.linked = so.getBoolean(stringIDToTypeID("linked"));
smartObject.fileRef = so.getString(stringIDToTypeID("fileReference"));
return smartObject;
} catch (e) {
return {
found: false,
fileRef: '',
linked: false,
};
}
}
function placedLayerConvertToLinked(layer, theTempFile) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putIdentifier(s2t("layer"), layer.id);
descriptor.putReference(s2t("null"), reference);
descriptor.putPath(s2t("using"), new File(theTempFile));
executeAction(s2t("placedLayerConvertToLinked"), descriptor, DialogModes.NO);
}
function readBinaryFile(tempVectorFile) {
if (!tempVectorFile.exists) {
return null;
}
tempVectorFile.open("r");
tempVectorFile.encoding = "BINARY";
var binaryData = tempVectorFile.read();
tempVectorFile.close();
return binaryData;
}
function searchInBinaryData(binaryData, searchString) {
var regex = new RegExp(searchString, "g");
return regex.test(binaryData);
}
... View more
4 hours ago
@code_seeeeeker
I wrote a different script for that, so no need to alter that code:
https://community.adobe.com/t5/photoshop-ecosystem-ideas/new-feature-request-layers-to-pdf/idc-p/14901556#U14901556
... View more
11 hours ago
1 Upvote
@siliconmana as you mentioned there isnt a good solution yet to save all variations in the project. A good proposal would be something similar to what @turner111 posted which would be a "convert to layers" option but keep your original generated layer to preserve the AI results for future modification.
By @Kevin Stohlmeyer
The scripts mentioned on page 1 do just that:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/is-there-a-quot-simple-quot-way-to-export-all-generation-variations/m-p/14442568
... View more
Mar 10, 2025
1 Upvote
@Trevor.Dennis
Hah, practice makes perfect?
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
05:07 PM
1 Upvote
‎Mar 10, 2025
05:07 PM
1 Upvote
@code_seeeeeker – The following script is for a single active layer (I started work on it before your full requirements were known). I'll look into adapting it for all layers.
/*
Check if the vector smart object in Photoshop is in RGB or CMYK mode.jsx
Stephen Marsh
v1.0 - 11th March 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/smartobject-in-photoshop/td-p/15195068
Info: Alerts the color mode of the active vector smart object layer
*/
#target photoshop
// Check if there is an active document
if (app.documents.length > 0) {
try {
// Single history stage undo
app.activeDocument.suspendHistory("Undo Script", "main()");
function main() {
// Check that the SO is an Adobe Illustrator file
var mySO = getSmartObjectName();
if (mySO.found && /\.ai$/.test(mySO.fileRef)) {
// Check that the active layer is an embedded SO
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));
if (so.getBoolean(stringIDToTypeID("linked")) === false) {
// Convert the vector smart object to a linked PDF file, as a means to read the color mode
placedLayerConvertToLinked("~/Desktop/_temp-VectorToDelete.pdf");
// Undo the previous action to keep the vector smart object as it was
executeAction(charIDToTypeID("undo"), undefined, DialogModes.NO);
// Set the path to the temporary vector file
var tempVectorFile = File("~/Desktop/_temp-VectorToDelete.pdf");
// Get the active document color mode
var doc = app.activeDocument;
var colorMode = doc.mode;
var docColorMode = "Document color mode = ";
switch (colorMode) {
case DocumentMode.GRAYSCALE:
docColorMode += "Grayscale";
break;
case DocumentMode.RGB:
docColorMode += "RGB";
break;
case DocumentMode.CMYK:
docColorMode += "CMYK";
break;
case DocumentMode.LAB:
docColorMode += "Lab";
break;
}
// Read the binary data of the temporary vector file and alert if the color mode is RGB or CMYK
if (tempVectorFile) {
var binaryData = readBinaryFile(tempVectorFile);
if (binaryData !== null) {
var searchString = "_ColorModel: 1"; // %AI9_ColorModel: 2 for CMYK
var found = searchInBinaryData(binaryData, searchString);
if (found) {
alert("Color Info:" + "\r" + docColorMode + "\r" + "Vector smart object color mode = RGB");
} else {
alert("Color Info: " + "\r" + docColorMode + "\r" + "Vector smart object color mode = CMYK");
}
}
} else {
alert("The file '_temp-VectorToDelete.pdf' wasn't found on the desktop!");
}
// Delete the temporary vector file
tempVectorFile.remove();
} else {
alert("The layer isn't an Embedded Smart Object!");
}
} else {
alert("Select an Adobe Illustrator Smart Object layer!");
}
}
} catch (error) {
//alert(error + ', Line: ' + error.line);
}
} else {
alert("A file must be open to run this script!");
}
///// Functions /////
function placedLayerConvertToLinked(theTempFile) {
try {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
descriptor.putReference(s2t("null"), reference);
descriptor.putPath(s2t("using"), new File(theTempFile));
executeAction(s2t("placedLayerConvertToLinked"), descriptor, DialogModes.NO);
} catch (error) {
//alert(error + ', Line: ' + error.line);
}
}
function readBinaryFile(tempVectorFile) {
try {
if (!tempVectorFile.exists) {
alert("File not found!");
return null;
}
tempVectorFile.open("r");
tempVectorFile.encoding = "BINARY";
var binaryData = tempVectorFile.read();
tempVectorFile.close();
return binaryData;
} catch (error) {
alert(error + ', Line: ' + error.line);
}
}
function searchInBinaryData(binaryData, searchString) {
try {
var regex = new RegExp(searchString, "g");
return regex.test(binaryData);
} catch (error) {
alert(error + ', Line: ' + error.line);
}
}
function getSmartObjectName() {
/* https://stackoverflow.com/questions/63010107/get-a-smart-objects-layers-files-directory-source-in-jsx */
try {
var smartObject = {
found: false,
fileRef: '',
linked: false,
};
var ref, so;
ref = new ActionReference();
ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));
smartObject.found = true;
smartObject.linked = so.getBoolean(stringIDToTypeID("linked"));
smartObject.fileRef = so.getString(stringIDToTypeID("fileReference"));
return smartObject;
}
catch (error) {
//alert(error);
return smartObject;
}
}
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
02:32 PM
1 Upvote
‎Mar 10, 2025
02:32 PM
1 Upvote
Why cant I just save as jpg?
By @Valeria_Ascencio2720
You can output a JPEG by:
1) File > Export As [32/16/8 BPC input for 8 BPC output]
2) Save a Copy using File > Save As ticking the a Copy checkbox or enable Legacy Save As in your File Handling preferences/settings [16/8 BPC input for 8 BPC output]
3) File > Export > Save for Web (Legacy) [16/8 BPC input for 8 BPC output]
4) Make the file, or a duplicate of the file conform to the JPEG specification, i.e., flattened with no layers, no alpha channels and only 8 BPC so that JPEG is available for File > Save As (if Legacy Save As isn't enabled).
5) Adobe Generator/Generate Image Assets
... View more
‎Mar 10, 2025
10:46 AM
Until Photoshop has AI masking that can be correctly batched, you appear to be stuck.
A long standing feature request is to save the AI masks from ACR as an alpha channel or applied layer mask.
Depending on your layer structure it might be possible to batch script combining the results of the AI masks from flattened TIFF versions with the original layered images, using their existing transparency.
... View more
‎Mar 10, 2025
10:28 AM
I'll post some code later on... Or you could just use xnconvert as previously suggested.
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
06:55 AM
1 Upvote
‎Mar 10, 2025
06:55 AM
1 Upvote
So when you edit the vector SO it opens into Illustrator or whatever app is set as default for the file type extension, then you know the colour mode. This is why I asked if you wanted to try avoid this.
What are you wanting? An alert to pop up stating the colour mode without having to launch Illustrator?
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
06:52 AM
1 Upvote
‎Mar 10, 2025
06:52 AM
1 Upvote
ACR is nondestructive.
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
05:02 AM
1 Upvote
‎Mar 10, 2025
05:02 AM
1 Upvote
For context, my work requires me to manually open a large amount of photos
By @noah_7511
Opening 170 files at the same time isn't a great workflow. If you must do this, you might find the following script to be useful:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/scripts-to-save-amp-restore-photoshop-sessions/m-p/14239969#U14946306
Depending on workflow and edits, if all of your images are in a single folder, a script might be better at opening them while keeping track of the next file/s to open.
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-open-a-number-of-images-but-one-at-a-time/m-p/13804564#U15090907
P.S. Do you even need to open the files into Photoshop? Are they all in the same folder? Could Adobe Bridge be used to select and copy the files rather than opening them in Photoshop?
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
05:00 AM
1 Upvote
‎Mar 10, 2025
05:00 AM
1 Upvote
This updated 1.1 version uses native Mac and Windows copy commands. In the case of the Mac, coloured Finder labels and Finder Comments will be preserved.
/*
Copy open files in Photoshop to a destination folder 1-1.jsx
Stephen Marsh
v1.1 - 10th March 2025
Original discussion:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-copy-the-name-of-multiple-open-documents-to-a-single-text-file/td-p/15201067
*/
#target photoshop
var destinationFolder = selectDestinationFolder();
if (destinationFolder) {
var openDocs = app.documents.length;
var initialFileCount = getFileCount(destinationFolder);
// Loop over all open documents
for (var i = 0; i < app.documents.length; i++) {
var doc = app.documents[i];
var docPath = doc.fullName.fsName; // Get the full path of the document in the OS-specific format
//alert(docPath);
if (docPath) {
// If the file copy fails, alert to the user with the path of the file that failed to copy
if (!copyFile(docPath, destinationFolder.fsName)) {
alert("Failed to copy: " + docPath);
}
}
}
var finalFileCount = getFileCount(destinationFolder);
var filesCopied = finalFileCount - initialFileCount;
// End of script notification
app.beep();
alert("Script completed!" + "\r" +
"Open document count: " + openDocs + "\n" + "Files copied: " + filesCopied);
// Open the destination folder
destinationFolder.execute();
}
function selectDestinationFolder() {
var destinationFolder = Folder.selectDialog("Select the destination folder");
if (destinationFolder == null) {
//alert("No destination folder selected. Script cancelled.");
}
return destinationFolder;
}
// New function to count files in a folder
function getFileCount(folder) {
var files = folder.getFiles();
return files.length;
}
/*
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/to-move-files-and-folders/td-p/8787869/page/2
by willcampbell7
*/
function copyFile(sourceFilePath, destinationFolderPath) {
var command;
var fileFrom = new File(new File(sourceFilePath).fsName);
var fileTo = new File(destinationFolderPath + "/" + fileFrom.name);
var folderTo = new Folder(destinationFolderPath);
if (!folderTo.exists) {
folderTo.create();
}
if (File.fs == "Macintosh") {
// First copy the file
command = "cp \"" + fileFrom.fsName + "\" \"" + fileTo.fsName + "\"";
app.system(command);
// Use a standalone AppleScript file for Finder comment copying
var scriptContent = 'tell application "Finder"\n' +
' set sourceFile to POSIX file "' + fileFrom.fsName.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + '" as alias\n' +
' set destFile to POSIX file "' + fileTo.fsName.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + '" as alias\n' +
' set commentText to comment of sourceFile\n' +
' if commentText is not "" then\n' +
' set comment of destFile to commentText\n' +
' end if\n' +
'end tell';
// Create a temporary AppleScript file
var scriptFile = new File("/tmp/copy_comment.applescript");
scriptFile.encoding = "UTF-8";
scriptFile.open("w");
scriptFile.write(scriptContent);
scriptFile.close();
// Execute the script with proper permissions
app.system("osascript /tmp/copy_comment.applescript");
// Clean up
app.system("rm /tmp/copy_comment.applescript");
} else if (File.fs == "Windows") {
command = "copy \"" + fileFrom.fsName + "\" \"" + fileTo.fsName + "\"";
app.system(command);
}
if (fileTo.exists) {
return true;
} else {
return false;
}
}
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
02:27 AM
1 Upvote
‎Mar 10, 2025
02:27 AM
1 Upvote
@noah_7511 wrote:
Hi all! This is something I've been trying to brute force on my own by frankenstiening older posted scripts, but my lack of scripting know-how is really getting in the way.
For context, my work requires me to manually open a large amount of photos, then use 'Open in explore' to then copy its file name, THEN to find it in another folder by using the windows search bar to copy it to a final folder location. And this is PER image.
As you might be able to tell, this take a considerate amount of time for a task that could be automated.
This could be scripted, i.e. the selection of the output folder, then the script copying the open files to the folder.
EDIT: At a basic level, something like this native JS .copy command. It's assumed that the files are saved and ready to copy.
/*
Copy open files in Photoshop to a destination folder.jsx
Stephen Marsh
v1.0 - 10th March 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-copy-the-name-of-multiple-open-documents-to-a-single-text-file/td-p/15201067
*/
#target photoshop
var destinationFolder = selectDestinationFolder();
var openDocs = app.documents.length;
var counter = 0;
// Loop over all open documents
for (var i = 0; i < app.documents.length; i++) {
var doc = app.documents[i];
var docPath = doc.fullName.fsName; // Get the full path of the document in the OS-specific format
//alert(docPath);
copyFile(docPath, destinationFolder.fsName); // Use the OS-specific path of the destination folder
counter++;
}
// End of script notification
app.beep();
alert("Script completed!" + "\r" + "Open document count: " + openDocs + "\n" + "Files copied: " + counter);
function selectDestinationFolder() {
var destinationFolder = Folder.selectDialog("Select the destination folder");
if (destinationFolder == null) {
//alert("No destination folder selected. Script cancelled.");
}
return destinationFolder;
}
function copyFile(sourceFilePath, destinationFolderPath) {
var sourceFile = new File(sourceFilePath);
var destinationFile = new File(destinationFolderPath + "/" + sourceFile.name);
sourceFile.copy(destinationFile);
}
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 10, 2025
02:23 AM
1 Upvote
‎Mar 10, 2025
02:23 AM
1 Upvote
I would use Camera Raw to change them but it doesn't live preview layers below the current one...
By @Oneechan69
How about selecting the layers and converting them to a smart object, then using the Camera Raw filter as a smart filter.
... View more
‎Mar 09, 2025
05:18 PM
I have no idea which script you are using, there were multiples posted in this topic. Perhaps it's time to try a different script, there are many on the forum to be found via a search.
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 09, 2025
05:14 PM
1 Upvote
‎Mar 09, 2025
05:14 PM
1 Upvote
Thank you for trying!
Looks like I'll need to stick with the confirm prompt and put the onus on the user (not to mention that rewriting this script in UXP isn't possible for me).
... View more
‎Mar 08, 2025
07:45 PM
Works perfectly, I use this quite frequently, Thanks!
By @JesseTomi
You're welcome!
As a regular user of the script, do you have any suggestions or requests?
... View more
‎Mar 08, 2025
06:37 PM
Thank you it works!
By @Christian37649906skks
You're welcome and thank you for taking the time to post feedback!
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 08, 2025
06:24 PM
1 Upvote
‎Mar 08, 2025
06:24 PM
1 Upvote
@Stephen Marsh Thank you so much! I replaced those 5 lines and it has fixed part of the problem. The Glow Size and Glow Brightness parameters are now being correctly randomized. Unfortunately, the color/RGB values still aren't. Do you know what could be causing this? Is it a CharID to StringID issue or something else?
By @ugonnaa21431338
Here is my code:
var neonGlowRandomSize = Math.floor(Math.random() * 49) - 24; // Range: -24 to 24;
var neonGlowRandomBrightness = Math.floor(Math.random() * 51); // Range: 0-50;
var neonGlowRandomRed = Math.floor(Math.random() * 256);
var neonGlowRandomGreen = Math.floor(Math.random() * 256);
var neonGlowRandomBlue = Math.floor(Math.random() * 256);
applyNeonGlowFilter(neonGlowRandomSize, neonGlowRandomBrightness, neonGlowRandomRed, neonGlowRandomGreen, neonGlowRandomBlue);
function applyNeonGlowFilter(size, brightness, red, green, blue) {
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor.putEnumerated(c2t("GEfk"), c2t("GEft"), s2t("neonGlow"));
descriptor.putInteger(s2t("size"), size);
descriptor.putInteger(s2t("brightness"), brightness);
descriptor2.putDouble(s2t("red"), red);
descriptor2.putDouble(s2t("grain"), green);
descriptor2.putDouble(s2t("blue"), blue);
descriptor.putObject(s2t("color"), s2t("RGBColor"), descriptor2);
executeAction(c2t("GEfc"), descriptor, DialogModes.NO);
}
Edit: Sorry, I forgot to tell you to update from:
descriptor.putObject(s2t("Clr "), s2t("RGBC"), colorDescriptor);
to:
descriptor.putObject(s2t("color"), s2t("RGBC"), colorDescriptor);
... View more
‎Mar 08, 2025
03:14 PM
@ugonnaa21431338
You have done well so far!
I think that the issue is in these 5 lines in your function:
descriptor.putInteger(s2t("Sz "), size); // Randomized Glow Size
descriptor.putInteger(s2t("Brgh"), brightness); // Randomized Glow Brightness var colorDescriptor = new ActionDescriptor();
colorDescriptor.putInteger(s2t("Rd "), red);
colorDescriptor.putInteger(s2t("Grn "), green);
colorDescriptor.putInteger(s2t("Bl "), blue);
Which should be:
descriptor.putInteger(s2t("size"), size); // Randomized Glow Size
descriptor.putInteger(s2t("brightness"), brightness); // Randomized Glow Brightness colorDescriptor.putInteger(s2t("red"), red);
colorDescriptor.putInteger(s2t("grain"), green);
colorDescriptor.putInteger(s2t("blue"), blue);
The issue is that you haven't converted the charID's to the expected stringID's. I created a couple of scripts to convert between these here (don't input the quote marks):
https://community.adobe.com/t5/photoshop-ecosystem-discussions/action-manager-scripting/td-p/11160326
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 08, 2025
01:53 PM
4 Upvotes
‎Mar 08, 2025
01:53 PM
4 Upvotes
Alpha channels are greyscale, ranging from white to black with grey values in between.
Spot channels are a special type of alpha channel. As they are for print production, they use a subtractive colour model, where white = 0% and black = 100%.
Colour values are assigned to the spot channel via it's properties rather than by using a colour swatch or mixer values as would normally be the case for RGB/CMYK/Lab colour pixels.
There's a lot of room for error with spot channels if you're new to them.
What are you doing and where and how will the spot channel be used?
https://helpx.adobe.com/au/photoshop/using/channel-basics.html
https://helpx.adobe.com/au/photoshop/using/printing-spot-colors.html
... View more
‎Mar 08, 2025
04:15 AM
That's great! It reminds me of AppleScript having the ability to either run JSX "inline" or by calling an external JSX file to accomplish tasks outside of the AS DOM.
... View more
‎Mar 08, 2025
03:01 AM
Here's a slightly different take on the previous script, this one leverages colour range to load all pure black pixels as a selection and then compares the selection width to the document width. If both match, then the file is logged as possibly containing a black row. As with the previous code, this isn't perfect and there may be cases where false positives are flagged.
/*
Log Files With Black Full Width Line to Text File Slower.jsx
Stephen Marsh
v1.0 - 8th March 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/black-horizontal-line-across-the-image-after-save-to-tif/m-p/15195817
*/
#target photoshop
// Open dialog to select files
var theFiles = File.openDialog("Select files to check for full width 0r0g0b pixels", true);
if (theFiles) {
processFiles(theFiles);
} else {
alert("No files selected.");
}
// Function to check histogram for 0r0g0b
function checkHistogramForBlack(doc) {
var histo = doc.histogram;
return histo[0] > 0;
}
function selectColorRange(fuzziness, luminance, a, b, luminance2, a2, b2, colorModel) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var descriptor3 = new ActionDescriptor();
descriptor.putInteger(s2t("fuzziness"), fuzziness);
descriptor2.putDouble(s2t("luminance"), luminance);
descriptor2.putDouble(s2t("a"), a);
descriptor2.putDouble(s2t("b"), b);
descriptor.putObject(s2t("minimum"), s2t("labColor"), descriptor2);
descriptor3.putDouble(s2t("luminance"), luminance2);
descriptor3.putDouble(s2t("a"), a2);
descriptor3.putDouble(s2t("b"), b2);
descriptor.putObject(s2t("maximum"), s2t("labColor"), descriptor3);
descriptor.putInteger(s2t("colorModel"), colorModel);
executeAction(s2t("colorRange"), descriptor, DialogModes.NO);
}
function processFiles(theFiles) {
var resultFile = new File(Folder.desktop + "/BlackPixelsCheckResults.txt");
resultFile.open("w");
resultFile.writeln("Files possibly containing full width 0r0g0b pixels:\n");
// Counter for files with 0r0g0b pixels
var blackFilesCount = 0;
// Loop through files
for (var i = 0; i < theFiles.length; i++) {
var theFile = theFiles[i];
var doc = app.open(theFile);
selectColorRange(0, 0, 0, 0, 0, 0, 0, 0);
var selectionBounds = activeDocument.selection.bounds;
var selectionWidth = selectionBounds[2].as("px") - selectionBounds[0].as("px");
if (app.activeDocument.width.as("px") === selectionWidth) {
resultFile.writeln(theFile.fsName);
blackFilesCount++; // Increment counter when 0r0g0b pixels are found
}
doc.close(SaveOptions.DONOTSAVECHANGES);
}
// End of script notification
resultFile.close();
alert("Processing complete!\n" + "Total files checked: " + theFiles.length + "\n" +
"Files with possible full width black pixels: " + blackFilesCount + "\n" +
"Results saved to: " + resultFile.fsName);
resultFile.execute();
}
... View more
‎Mar 07, 2025
08:35 PM
@William35585738b0s9
You’re welcome! The official guide could use more examples, I think that they tried to keep it simple:
https://helpx.adobe.com/au/photoshop/using/creating-data-driven-graphics.html
... View more
‎Mar 07, 2025
07:59 PM
You have 5 variables in the CSV, but only 4 text are defined in the PSD, the pixel replacement isn't defined.
Additionally, there are visibility variables for each text layer in the PSD, so a column would also be needed for that with boolean values.
I have tested with both the standard PSD data set export and exporting direct to JPEG, WEBP etc:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/using-datasets/td-p/2665594/page/2#U15189770
... View more
‎Mar 07, 2025
06:52 PM
Please share the CSV and PSD.
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 07, 2025
05:49 PM
2 Upvotes
‎Mar 07, 2025
05:49 PM
2 Upvotes
A team effort then!
... View more
Community Expert
in Photoshop ecosystem Discussions
‎Mar 07, 2025
04:23 PM
3 Upvotes
‎Mar 07, 2025
04:23 PM
3 Upvotes
Sounds like the global light is active.
https://helpx.adobe.com/au/photoshop/using/layer-effects-styles.html
... View more