Mobile app version of vmapp.org
Login or Join
BetL875

: Apply script only to the 2nd layer of every PSD file How can I apply this code only to the 2nd layer of every PSD file? I also want to avoid color selection instead give the hex color

@BetL875

Posted in: #AdobePhotoshop #Automation #PhotoshopScripting

How can I apply this code only to the 2nd layer of every PSD file? I also want to avoid color selection instead give the hex color code of black to remove.

var doc = app.activeDocument;
for(var i = 0; i < doc.layers.length; i++){
doc.activeLayer = doc.layers[i];
app.doAction("YOUR_ACTION_NAME_HERE", "YOUR_ACTION_SET_NAME_HERE");
doc.activeLayer.visible = false;
}


The code appears here: How do I delete all white pixels from several layers?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @BetL875

1 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel278

Press Alt + F9 to open Action window
Click on "Create a set" button and rename it to mySet

Click on "Create an Action" button and rename it to myAction
Go to Select -> Color Range (selected black) pressed OK then hit Delete
button on keyboard to delete the black colors, and then press CTRL + D to deselect the current selection
Press Stop button in Action window
open notepad and copy and paste the following code



var doc = app.activeDocument;
doc.activeLayer = doc.layers[1];
app.doAction("myAction", "mySet");


In notepad save the file with ".jsx" extention

go to Photoshop -> File -> Scripts -> Browse... and select your script and run it.
This script will run Action on your second layer

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme