Created
May 31, 2013 14:16
-
-
Save chrisdroukas/5685265 to your computer and use it in GitHub Desktop.
Exports selected groups as new PSDs. Via this Adobe Forums thread: http://forums.adobe.com/thread/791896
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #target photoshop | |
| main(); | |
| function main() { | |
| if(!documents.length) return; | |
| var doc = activeDocument; | |
| var oldPath = activeDocument.path; | |
| var Name = app.activeDocument.name.replace(/\.[^\.]+$/, ''); | |
| dupLayers(); | |
| var saveFile= File(oldPath +"/"+Name +"-NewGroups.psd"); | |
| SavePSD(saveFile); | |
| app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); | |
| } | |
| function dupLayers() { | |
| var desc143 = new ActionDescriptor(); | |
| var ref73 = new ActionReference(); | |
| ref73.putClass( charIDToTypeID('Dcmn') ); | |
| desc143.putReference( charIDToTypeID('null'), ref73 ); | |
| desc143.putString( charIDToTypeID('Nm '), activeDocument.activeLayer.name ); | |
| var ref74 = new ActionReference(); | |
| ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); | |
| desc143.putReference( charIDToTypeID('Usng'), ref74 ); | |
| executeAction( charIDToTypeID('Mk '), desc143, DialogModes.NO ); | |
| } | |
| function SavePSD(saveFile) { | |
| psdSaveOptions = new PhotoshopSaveOptions(); | |
| psdSaveOptions.embedColorProfile = true; | |
| psdSaveOptions.alphaChannels = true; | |
| activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment