Save all layer combinations of 2 folders and keep one layer outside of the folders always visible no matter what combination


i need script save images in jpg combining layers of 2 folders , keep 1 layer outside of 2 folders visible

folder1
-martin
-jean
folder2
-julie
-poline
1 layer outside of groups (must used every combinations)

wished result :

best jpg quality images saved in folder followed:

martin-julie.jpg
martin-poline.jpg
jean-julie.jpg
jean-poline.jpg

many thanks

i have script have 2 problems :

 

1/ works 1 folder , have 2

2/ doesnt rename saved files combining name of layers

 

// name: export layers inside selected group.jsx

// description: photoshop script separately saves top level layers inside selected group.

// https://gist.github.com/joonaspaakko/01 ... ba0fb9a2a0

 

#target photoshop

 

try {

var doc = app.activedocument;

var docname = doc.name.split('.')[0];

}

catch (e) {

alert( 'open document first...' );

}

 

function init() {

 

var savefiles;

 

dlg.g.saveas.minimumsize.width = 463;

dlg.btns.minimumsize.height = 142;

 

 

dlg.btns.save.onclick = function(){

savefiles = true;

dlg.close();

return savefiles;

};

 

dlg.show();

 

if ( savefiles ){

 

var getdestination = folder.selectdialog( 'select destination folder...', doc.saved ? doc.path : '' );

var group = doc.activelayer;

var grouplength = group.layers.length;

 

for( var = 0 ; < grouplength; i++ ){

group.layers[i].visible = false;

}

 

for( var = 0 ; < grouplength; i++ ){

 

var layer = group.layers[ ];

var layerindex = i+1;

 

layer.visible = true;

 

save.file( dlg, doc, getdestination, layerindex );

 

layer.visible = false;

 

}

 

alert('files saved!');

 

}

 

}

 

var save = {

file: function( dlg, doc, getdestination, layerindex ) {

 

var saveoptions = {};

var formats = ["psd", "pdf", "png", "jpg", "tiff"];

 

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

if ( dlg.g.saveas[ formats[i] ].value ) {

 

var fileformat = formats[i];

 

var path = getdestination + "/" + fileformat;

 

makefolder( path );

 

doc.saveas( file( path + "/" + dlg.g.filename.filename.text + layerindex ), save[fileformat](), true );

 

}

}

 

},

psd: function() {

 

var psd_saveopts = new photoshopsaveoptions();

 

psd_saveopts.layers = true;

psd_saveopts.embedcolorprofile = true;

psd_saveopts.annotations = true;

psd_saveopts.alphachannels = true;

 

return psd_saveopts;

 

},

pdf: function() {

 

var presetname = '[high quality print]';

 

var pdf_saveopts = new pdfsaveoptions();

 

pdf_saveopts.pdfpreset = presetname;

 

return pdf_saveopts;

 

},

jpg: function() {

 

var jpg_saveopts = new jpegsaveoptions();

 

jpg_saveopts.matte = mattetype.white;

jpg_saveopts.quality = 10;

jpg_saveopts.formatoptions.standardbaseline;

 

return jpg_saveopts;

 

},

png: function() {

 

var png_saveopts = new pngsaveoptions();

 

png_saveopts.compression = 9;

png_saveopts.interlaced = false;

 

return png_saveopts;

 

},

tiff: function() {

 

var tiff_saveopts = new tiffsaveoptions();

 

tiff_saveopts.alphachannels = true;

tiff_saveopts.annotations = true;

tiff_saveopts.imagecompression = tiffencoding.jpeg;

tiff_saveopts.interleavechannels = true;

tiff_saveopts.jpegquality = 10;

tiff_saveopts.layers = true;

tiff_saveopts.layercompression = layercompression.zip;

tiff_saveopts.transparency = true;

 

return tiff_saveopts;

 

}

};

 

// prepare dialog...

var dlg = new window("dialog { \

text: 'export layers inside selected group', \

alignchildren:['left','center'], \

orientation: 'row', \

g: group { \

orientation:'column', \

alignchildren: ['left','center'], \

filename: panel { \

orientation:'column', \

alignchildren: ['left','top'], \

filename_text: statictext { alignment:'left', text: 'filename ( incremental numbers added automatically ): '}, \

filename: edittext { alignment:'left', preferredsize: [430,20], text: '"+ docname +"', active: true }, \

}, \

saveas: panel { \

margins: 20, \

spacing: 20, \

orientation: 'row', \

alignchildren: ['left','top'], \

saveas_txt: statictext { text: 'save as: '}, \

jpg: checkbox { text: 'jpg', value: true }, \

psd: checkbox { text: 'psd', value: false }, \

pdf: checkbox { text: 'pdf', value: false }, \

png: checkbox { text: 'png', value: false }, \

tiff: checkbox { text: 'tiff', value: false } \

} \

}, \

btns: panel { \

margins: 20, \

spacing: 20, \

orientation: 'column', \

alignment: ['right','top'], \

save: button { text: 'save', properties:{ name: 'ok' }, preferredsize:[88, 24] }, \

cancel: button { text: 'cancel', properties:{ name: 'cancel' }, preferredsize:[88, 24] }, \

} \

}");

 

function makefolder( path ) {

 

var newfolder = folder( path );

if( !newfolder.exists ) newfolder.create();

 

}

 

if ( app.documents.length > 0 ) {

if ( app.activedocument.activelayer.layers ) {

 

init();

 

}

else {

alert( "error: \nselect parent group of layers want export.")

}

}



More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working