Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I'm trying to figure out how to export multiple layer comps to a single psd in Adobe photoshop cc. When I use the "layer comps to files" script it exports each layer comp to it's own psd.

Much thanks.

share|improve this question
    
Took me a while, but I got it now, I think. I believe you have three options: 1. Remove all the comps you don't need and save a copy of the current file. 2. Find a script that does exactly what you want. 3. Make your own script that does exactly what you want ( Probably wouldn't be too difficult to bend that script to your will. ). –  Joonas May 28 at 23:28

2 Answers 2

up vote 1 down vote accepted

So... here's a script that should do what you want:

How to use the script: Select the layer comps you want to export and run the script. The rest of it is fairly self-explanatory.

Just save it as a .jsx file in the photoshop scripts folder and it should show up in the scripts list file > scripts > Selected Layer Comps to PSD...

Written for Photoshop CC, but it may work in older versions as well.

enter image description here

/*

Author: https://github.com/joonaspaakko
Gist: https://gist.github.com/joonaspaakko/09e8e2a218038e15344d

<javascriptresource>
<name>Menu=Selected Layer Comps to PSD...</name>
<category>layercomps</category>
</javascriptresource>

*/

// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop

try  {

    var save, cancel, dlg, tempkeep;

    // If documents exist, do stuff...
    if ( app.documents.length > 0 ) main();

    function main() {

        // Currently active document...
        var doc = app.activeDocument;

        // Document has been saved...
        try {

            var docPath = Folder( doc.fullName.parent ).fsName;
            var docName = decodeURI( doc.fullName.name.substring( 0, app.activeDocument.fullName.name.indexOf(".") ) );

        }
        // Document has not been saved...
        catch( e ) {

            var docPath = "";
            var docName = doc.name;

        }

        // THIS IS WHERE DECISIONS ARE MADE!?!?!?!?!?
        dialog( doc, docName, docPath );

        if ( !cancel ) {

            // Duplicate current document
            var tempDoc = doc.duplicate();

            // Get layer comps
            var layerComps = tempDoc.layerComps;

            var shredder = [];

            // Loop through each comp...
            for ( i = 0; i < layerComps.length; i++ ) {

                // Each looped comp
                var comp = layerComps[ i ];

                // If comp is not selected...
                if ( !comp.selected ) {

                    // ...push it to shredder
                    shredder.push( comp );

                }

            }

            // Loop through each shreddable comp...
            for ( i = 0; i < shredder.length; i++ ) {

                // Each looped comp
                var comp = shredder[ i ];

                // Shred it
                comp.remove();

            }

            // Save temporary document as a psd file.
            if ( save ) savePSD( doc, docName, docPath, tempDoc);

            // Close temporary document.
            tempDoc.close( SaveOptions.DONOTSAVECHANGES );

            // If user checks the checkbox "Keep new file open",
            // this part of the code actually opens up the file again...
            if ( dlg.export.tempkeep.value ) {

                // Find the file we just saved...
                var savedFile = new File( dlg.destination.input.text + '/' + dlg.filename.input.text + '.psd' );

                // ...open it
                app.open( savedFile );

            }

        }
    }
} catch ( e ) {}

function dialog( doc, docName, docPath, tempDoc ) {

    // Prepare dialog...
    var dialog = "dialog {  \
        text: 'Export selected layer comps as PSD', \
        destination: Panel { \
            alignment: 'left', \
            alignChildren:['left','top'], \
            orientation: 'row', \
            text: 'File destination', \
            input: EditText { text: '"+ docPath +"/', preferredSize: [230,20] }, \
            browse: Button { text: 'Browse...' }, \
        }, \
        filename: Panel { \
            alignment: 'left', \
            alignChildren:['left','top'], \
            orientation: 'row', \
            text: 'Filename', \
            input: EditText { text: '"+ docName +"', active: true, preferredSize: [320,20] }, \
        }, \
        export: Group { \
            alignment: 'right', \
            orientation: 'row', \
            tempkeep: Checkbox { text: 'Keep new file open', value: false }, \
            save: Button { text: 'Save', properties:{ name: 'ok' } }, \
            cancel: Button { text: 'Cancel' }, \
        } \
    }";

    // Make dialog
    dlg = new Window( dialog );

    // Browse click event...
    dlg.destination.browse.onClick = function() {

        // Browse for destination
        destination = Folder.selectDialog("Select destination", docPath );

        // If destination was selected above...
        if ( destination != null ) {
            // Update input path
            dlg.destination.input.text = destination.fsName;
        }

    }

    dlg.export.save.onClick = function() {

       save = true;
       dlg.close();

    }

    dlg.export.cancel.onClick = function() {

        cancel = true;
        dlg.close();

    }

    // Show dialog
    dlg.show();


}

function savePSD( doc, docName, docPath, tempDoc ) {

    // Options for the psd file
    var psd_Opt = new PhotoshopSaveOptions();

    psd_Opt.layers = true; // Keep layers
                           //
    // Save active document to the selected destination
    tempDoc.saveAs( File( dlg.destination.input.text + '/' + dlg.filename.input.text + '.psd' ), psd_Opt, true );

    app.beep();

}
share|improve this answer

I use a very helpful action, almost every day.

https://github.com/jasonlong/Photoshop-Web-Workflow

You can select the layers you want, hit F1, and they will all be exported to a new window. You can save the document, export them for web, etc.

share|improve this answer
    
Getting "make" not available for saving to single psd in photoshop cc. –  user1676691 May 29 at 17:15
    
@user1676691 Could be that your PS version is lower than the one used to make this action. On another note, it helps you export Layers not Layer comps. –  Joonas May 29 at 19:23
    
@Joonas hmm... I have the latest version of adobe cc. –  user1676691 May 30 at 16:03
    
@user1676691 I believe it could happen even if the action was made with a lower version too. I'm not 100%, but to me it sounds like the action is trying to do something that your PS does not understand. But again, this action does not do what you want. I'm 100% sure of that. –  Joonas May 30 at 16:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.