title: Function to show/hide layer with Photoshop script (JSX)
body: <p>I am writing a script that will loop through layers, trim them and export. So far I have most of all the element I need to complete this script. The only thing I can't find is how to show/hide an individual layer. I've found functions to show/hide all layers but nothing for one single layer. </p>
  
  <pre><code>///////////////////////////////////////////////////////////////////////////////
  // selectAllLayers - select all layers (Select &gt; All Layers)
  ///////////////////////////////////////////////////////////////////////////////
  function selectAllLayers() {
      var ref = new ActionReference();
      ref.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
      var desc = new ActionDescriptor();
      desc.putReference(cTID('null'), ref);
  
      executeAction(sTID('selectAllLayers'), desc, DialogModes.NO);
  }
  
  ///////////////////////////////////////////////////////////////////////////////
  // hideLayers - hide all selected layers (Layer &gt; Hide Layers)
  ///////////////////////////////////////////////////////////////////////////////
  function hideLayers() {
      var ref = new ActionReference();
      ref.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
      var list = new ActionList();
      list.putReference(ref);
      var desc = new ActionDescriptor();
      desc.putList(cTID('null'), list);
      executeAction(cTID('Hd  '), desc, DialogModes.NO);
  }
  
  function cTID(s) {return app.charIDToTypeID(s);}
  function sTID(s) {return app.stringIDToTypeID(s);}
  </code></pre>
  
  <p>Any ideas?</p>