Copy link to clipboard
Copied
hi guys..
I have a folder containing a lot of ( *.PSD files )
i need change all ( TEXT ) layers color for all thess *.PSD
just ( TEXT ) layers
i searched and i get this code and it's not work i have error message
#target photoshop;
main();
function main(){
//select folder where PSDs are held
var selectFolder = Folder.selectDialog( "Please select folder of PSDs");
//if no folder selected quit.
if(selectFolder == null) return;
//get an array of all PSDs in the folder
var fileList = selectFolder.getFiles("*.psd");
//iterate through file list
for(var a in fileList){
var textColour = new SolidColor();
textColour.rgb.hexValue = "00ff00"; //set colour to green
open(fileList);
activeDocument.activeLayer = activeDocument.artLayers[0]; //Select top layer
if(activeDocument.activeLayer.kind == LayerKind.TEXT){ //check if it is a text layer
activeDocument.activeLayer.textItem.color = textColour; //set text to colour
activeDocument.save(); //Save changes
activeDocument.close(SaveOptions.DONOTSAVECHANGES); //Close document
}else{//not a text layer so close document
activeDocument.close(SaveOptions.DONOTSAVECHANGES); //Close document
}
}//end of filelist
};
when i run scrpit and choose folder i get this error
this line 27
please help me
Replace lines from 22 to 34 of your original code to:
(sc = SolidColor).rgb.hexValue = '00ff00', lrs = [].slice.call((aD = open(fileList[a])).layers)
while(lrs.length) (shft = lrs.shift()).kind == 'LayerKind.TEXT' ? shft.textItem.color = sc : shft.remove()
Copy link to clipboard
Copied
note:
any *.PSD file contain thees layers
Copy link to clipboard
Copied
open(fileList[a])
Copy link to clipboard
Copied
thank you bro, but i have other problem i need change color for hidden layers
and remove all layer not a TEXT
Copy link to clipboard
Copied
Hidden status of text layers doesn't prevent from changing their colour.
Remove all layer, which one, not text one? But which exact 'all' layer?
Copy link to clipboard
Copied
whell, it's change just first layer to green!
and other layers didn't change their colors what's wrong?
#target photoshop;
main();
function main(){
//select folder where PSDs are held
var selectFolder = Folder.selectDialog( "Please select folder of PSDs");
//if no folder selected quit.
if(selectFolder == null) return;
//get an array of all PSDs in the folder
var fileList = selectFolder.getFiles("*.psd");
//iterate through file list
for(var a in fileList){
var textColour = new SolidColor();
textColour.rgb.hexValue = "00ff00"; //set colour to green
open(fileList[a])
if(activeDocument.activeLayer.kind == LayerKind.TEXT){ //check if it is a text layer
activeDocument.activeLayer.textItem.color = textColour; //set text to colour
activeDocument.save(); //Save changes
activeDocument.close(SaveOptions.DONOTSAVECHANGES); //Close document
}else{//not a text layer so close document
activeDocument.close(SaveOptions.DONOTSAVECHANGES); //Close document
}
}//end of filelist
};
Copy link to clipboard
Copied
I want to remove all layers if they are not TEXT layers
Copy link to clipboard
Copied
Replace lines from 22 to 34 of your original code to:
(sc = SolidColor).rgb.hexValue = '00ff00', lrs = [].slice.call((aD = open(fileList[a])).layers)
while(lrs.length) (shft = lrs.shift()).kind == 'LayerKind.TEXT' ? shft.textItem.color = sc : shft.remove()
Copy link to clipboard
Copied
nice bro it's work fine! i need final request
i need delete custome layer by name
example:
if TEXT layer her name ( SEMO )
i want delete it only
Copy link to clipboard
Copied
Instead of:
?
put this code:
&& shft.name != 'SEMO' ?
btw if previous answer is what you wanted mark it as correct solution 😉