Control adding photoshop layers with script?
I don't know exactly why the other post is hidden but adobe's tech support is getting tired of dealing with people abusing their mark spam system and is working on ways to fix that.
I'm trying to make a jsx script that allows me to add up to 20 layers at a time and any number of layers in between 0 and 20 and also take them away if I decrease the number before closing the script. I noticed that in Photoshop one is required to use the dialog class which could be part of the problem:
var myPanel = new Window("dialog","Slider Control",undefined,{resizeable: true});
var sliderText = myPanel.add("statictext",undefined,undefined);
var slider = myPanel.add ("slider", undefined, 0, 0, 20);
var buttonExit = myPanel.add("button",undefined,"Close Dialog Box");
slider.size = [80, 20]
sliderText.text = "Layers";
k = Math.round(slider.value);
newArray =[]
slider.onChange = function (){
for (i=0; i<k; ++i){
newArray.push(activeDocument.activeItem.layers.add);
}
}
This script should generate a window and slider but does not seem to add new layers. If there is an error in the code that prevents the window from loading, let me know and I will try to fix it. Any help would be appreciated!
