Export layers to files and merge before

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

pahe

Export layers to files and merge before

Post by pahe »

Hi.

My name is Patrick and I'm trying to do a little tweak to the "Export layers to files" script in PS 5.1 CS. I'm a bit of a programmer, but I'm a bloody newbie to PS scripting. Luckily for me the script does already most of what I'm trying to achieve, but I want to merge all the layers of a group before. So I tried to understand what the script does and ended in:

Code: Select allif ((dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm.value == true)&&(png24Index == exportInfo.fileType)) { //transparancy checked?
   if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
                 var aDuplicate = activeDocument.activeLayer.merge();
                 activeDocument.activeLayer = aDuplicate;
      
                 app.activeDocument.trim(TrimType.TRANSPARENT);
   }
}


Sadly this doesn't work (though I think that this is the right spot). Could you please help me and tell me what is wrong here? As far as I understand is that the layer group is exported to a new document, then the document will be the "activeDocument" and then it should merge all the layers, trim the transparency away and export it to a file.

Thx for help guys!