Skip to content

Instantly share code, notes, and snippets.

@lm913
Created December 23, 2015 15:25
Show Gist options
  • Save lm913/48339bee47ad691e9ed4 to your computer and use it in GitHub Desktop.
Save lm913/48339bee47ad691e9ed4 to your computer and use it in GitHub Desktop.
Creates a New Layer within a pre-processing script
function psNewLayer(layerName,vis,lock,showHide){
//"HdAl" - Hides; "RvlA" - Reveal All; "RvlS" - Reveal Selection
var doc = app.activeDocument;
if(app.activeDocument.activeLayer.isBackgroundLayer){
app.activeDocument.activeLayer.name = layerName; //variable must be string
} else {
doc.artLayers.add().name = layerName; //variable must be string
}
if(!showHide) {showHide=null} else {psNewMask(showHide,layerName);}
if(vis==false) {doc.layers.getByName(layerName).visible = vis} else {lock=null;}
if(!lock) {lock=null} else {doc.layers.getByName(layerName).allLocked = lock;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment