skip to Main Content

I have a Photoshop layer/smart object named "Culoare". When I double click on it, there is another list of layers/smart objects. I need to be able to make visible/invisible the layers inside the first layer. For example, make "warm white" invisible and "blue" visible.

"Culoare" is the first object
I need to make visible or invisible the layers here

My code so far:

var doc = app.activeDocument;
var culoare = doc.layers[5];
doc.activeLayer = culoare;
culoare.visible = false;

2

Answers


  1. I don’t know much about photoshop script. But based on your code, it seems that the order of your last two lines should be:

    culoare.visible = false; 
    doc.activeLayer = culoare;
    

    That is ‘culoare’ should not be visible before you assign it to the active layer. I dont understand why you would want it to be invisible if you are assigning it to the active layer though.

    Login or Signup to reply.
  2. You’re nearly there! You don’t need to reference the culoare my the layer number as that may change. You can however, use the current active layer instead:

    // Create a reference to the active document
    var doc = app.activeDocument;
    
    // Create a variable "culoare" as a reference to the current active layer
    var culoare = doc.activeLayer;
    
    // Make culoare visible if it's hidden
    // or make culoare hidden if it's visible
    culoare.visible = !culoare.visible;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search