"Save png from two different groups" this scripting is not working in Photoshop CC 2015.5


#target photoshop

 

 

var doc=app.activedocument;

var layer=doc.activelayer;

var group=layer.parent.layers;

 

 

function savepng(){

    var pngoptions=new pngsaveoptions();

    if (group[0].name==" "){

        var str=" ";

        }else{

            var str="-"+grpup[0].name;

            }

        var path=file(doc.path+"/"+layer.name+str+".png");

        doc.saveas(path,pngoption,true,estension.lowercase);

        }

   

    function switchlayer(i){

        layer.visible=false;

        doc.activelayer=group[i]

        layer=doc.activelayer;

        layervisible=true;

        }

   

    (var i=0; i<group.length;i++){

        savepng();

        if(i+1>=group.length){

            break

            }

        switchlayer(i+1);

        }

   

    switchlayer(1);

   

    alert("all done!");

would mind elaborating?

maybe post meaningful screenshot 1 can see layer structure etc.?

 

app.activedocument

should

app.activedocument

            var str="-"+grpup[0].name;

has typo in »grpup«.

there more typos , disregard case-sensitivity …

you should trouble-shoot code , check out each line »throws error«.

 

also think have not worked out layer-hiding/showing properly, based on information provided it’s hard tell trying achieve.



More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Illustrator CS6 Ocurrío un error E/S en el archivo.

Why is os_ViewContainer running?

Animate - problem with duplicating scripts after loop