Hi All
I've got a script that works exactly how I want it but it's saving as PSD and my files are too big. Does anyone know how to make it save as PSB?
Thanks loads for any assistance!
Will
// select folder, create files with the contents of one of the subfolders each as layers and save them to the folder; // use it at your own risk; #target photoshop // select a folder; var sourceFolder = Folder.selectDialog("Select folder"); if (sourceFolder) { // the psd options; psdOpts = new PhotoshopSaveOptions(); psdOpts.embedColorProfile = true; psdOpts.alphaChannels = false; psdOpts.layers = true; psdOpts.spotColors = true; // get the contents as one array per folder; var items = retrieveFiles(sourceFolder, [[]]); // iterate through; for (var m = 1; m < items.length; m++) { var thisArray = items[m]; var folderName = thisArray[0].parent.name; // open file; var theImage = app.open(File(thisArray[0])); for (var n = 1; n < thisArray.length; n++) { // place rest of array; var theLayer = placeScaleFile(thisArray[n], 0, 0, 100); }; // save the stacked file; theImage.saveAs(new File(sourceFolder+"/"+folderName+".psd"),psdOpts,false); // close; theImage.close(SaveOptions.DONOTSAVECHANGES); }; }; ////// get from subfolders ////// function retrieveFiles (theFolder, theFiles) { if (!theFiles) {var theFiles = [[]]}; var theContent = theFolder.getFiles(); for (var n = 0; n < theContent.length; n++) { var theObject = theContent[n]; if (theObject.constructor.name == "Folder") { theFiles.push(new Array) retrieveFiles(theObject, theFiles) }; if (theObject.name.match(new RegExp(/\.(jpe|jpg|jpeg|gif|png|tif|tiff|bmp|psd|dng|pict|eps|raw|rw2|crw|cr2)/i)) != null) { theFiles[theFiles.length - 1].push(theObject) } }; return theFiles }; ////// get psds, tifs and jpgs from files ////// function getFiles (theFile) { if (theFile.name.match(/\.(eps|ai|jpg|tif|psd|pdf|)$/i)) { return true }; }; ////// place ////// function placeScaleFile (file, xOffset, yOffset, theScale) { // ======================================================= var idPlc = charIDToTypeID( "Plc " ); var desc5 = new ActionDescriptor(); var idnull = charIDToTypeID( "null" ); desc5.putPath( idnull, new File( file ) ); var idFTcs = charIDToTypeID( "FTcs" ); var idQCSt = charIDToTypeID( "QCSt" ); var idQcsa = charIDToTypeID( "Qcsa" ); desc5.putEnumerated( idFTcs, idQCSt, idQcsa ); var idOfst = charIDToTypeID( "Ofst" ); var desc6 = new ActionDescriptor(); var idHrzn = charIDToTypeID( "Hrzn" ); var idPxl = charIDToTypeID( "#Pxl" ); desc6.putUnitDouble( idHrzn, idPxl, xOffset ); var idVrtc = charIDToTypeID( "Vrtc" ); var idPxl = charIDToTypeID( "#Pxl" ); desc6.putUnitDouble( idVrtc, idPxl, yOffset ); var idOfst = charIDToTypeID( "Ofst" ); desc5.putObject( idOfst, idOfst, desc6 ); var idWdth = charIDToTypeID( "Wdth" ); var idPrc = charIDToTypeID( "#Prc" ); desc5.putUnitDouble( idWdth, idPrc, theScale ); var idHght = charIDToTypeID( "Hght" ); var idPrc = charIDToTypeID( "#Prc" ); desc5.putUnitDouble( idHght, idPrc, theScale ); var idLnkd = charIDToTypeID( "Lnkd" ); desc5.putBoolean( idLnkd, true ); executeAction( idPlc, desc5, DialogModes.NO ); return app.activeDocument.activeLayer; };