Skip to content

Instantly share code, notes, and snippets.

@hilukasz
Created May 8, 2012 13:10
Show Gist options
  • Save hilukasz/2634825 to your computer and use it in GitHub Desktop.
Save hilukasz/2634825 to your computer and use it in GitHub Desktop.
function doActionOnLayer(layerName, functionName) {
for (var i = 0; i < numberOfLayers; i++) {
var customName = layerName; //layerName should be string
var myLayer = app.activeDocument.layers[i];
var myLayer = myLayer.name;
if (customName == myLayer) {
var myLayerIndex = i;
return myLayerIndex;
functionName;
}
else { break; }
}
}
function testFunction() {
var alertL = app.activeDocument.layers[myLayerIndex];
var alertL = alertL.name;
alert(alertL); //this is to test concept
}
//run the action
doActionOnLayer("note", testFunction());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment