var runphotomergeFromScript = true; // must be before Photomerge include //@includepath "/Applications/Adobe Photoshop CS5/Presets/Scripts/" //@include "Photomerge.jsx" //@show include psdOpts = new PhotoshopSaveOptions(); psdOpts.embedColorProfile = true; psdOpts.alphaChannels = true; psdOpts.layers = true; var workFolder = Folder.selectDialog(); var folders = workFolder.getFiles( function( file ) { return file instanceof Folder; } ); for( var i = 0; i < folders.length; i++ ) { var folder = folders[i]; var fList = folder.getFiles( '*.pef' ); // override Photomerge.jsx settings. Default is "Auto". Uncomment to override the default. photomerge.alignmentKey = "Auto"; //photomerge.alignmentKey = "Prsp"; //photomerge.alignmentKey = "cylindrical"; //photomerge.alignmentKey = "spherical"; //photomerge.alignmentKey = "sceneCollage"; //photomerge.alignmentKey = "translation"; // "Reposition" in layout dialog // other setting that may need to be changed. Defaults below photomerge.advancedBlending = true; // 'Blend Images Together' checkbox in dialog photomerge.lensCorrection = true; // Geometric Distortion Correction'checkbox in dialog photomerge.removeVignette = true; // 'Vignette Removal' checkbox in dialog if( fList.length > 1 ){ photomerge.createPanorama(fList,false); } // The merged doc will be the activeDocument app.activeDocument.flatten(); app.activeDocument.bitsPerChannel = BitsPerChannelType.SIXTEEN; activeDocument.saveAs( new File( fList[0].parent + '/Completed.psd' ) , psdOpts, true, Extension.LOWERCASE); activeDocument.close( SaveOptions.DONOTSAVECHANGES ); }