Skip to main content
Known Participant
March 8, 2021
Answered

Auto-Save File After Creating Contact Sheet

  • March 8, 2021
  • 3 replies
  • 23012 views

Does anyone know how we can use the Automate>Contact Sheet II process, but to have Photoshop automatically save and even just close the files once it's done? For many folders from many scanned rolls, it's daunting to File>Save (or even Command+S, obviously) and to follow all the prompts for everything for each contact sheet when we just want them saved and closed out of at the end...

This topic has been closed for replies.
Correct answer Stephen Marsh

You can find the updated code to auto-save here:

 

https://raw.githubusercontent.com/MarshySwamp/Auto-Save-to-JPG-From-Contact-Sheet-II/main/Auto-Save-to-JPG-From-Contact-Sheet-II.jsx

 

Auto-Save-to-JPG-From-Contact-Sheet-II

 

Step 1 will be to select the save folder for the JPG files.

Step 2 will be the standard Contact Sheet II interface

Step 3 will be a message that all of the contact sheets have been saved to a specified path the save path will be opened in the Finder/Explorer.

 

Perhaps X or somebody else with more knowledge than me can comment on where/how to pickup the input folder and use that as the save location and or base-name prefix before the numbering suffix.

3 replies

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
March 12, 2021

You can find the updated code to auto-save here:

 

https://raw.githubusercontent.com/MarshySwamp/Auto-Save-to-JPG-From-Contact-Sheet-II/main/Auto-Save-to-JPG-From-Contact-Sheet-II.jsx

 

Auto-Save-to-JPG-From-Contact-Sheet-II

 

Step 1 will be to select the save folder for the JPG files.

Step 2 will be the standard Contact Sheet II interface

Step 3 will be a message that all of the contact sheets have been saved to a specified path the save path will be opened in the Finder/Explorer.

 

Perhaps X or somebody else with more knowledge than me can comment on where/how to pickup the input folder and use that as the save location and or base-name prefix before the numbering suffix.

aottkeAuthor
Known Participant
March 19, 2021

Hey. I found this, although it's related to Illustrator. Does this make sense? Think it might help/work? I'm not sure about implementation for any of this, but again, happy to show gratitude in a tip if this works (and still want to do something for you for the help before already!).

 

https://community.adobe.com/t5/illustrator/saving-to-a-relative-subfolder/m-p/9841856#M94609

 

Thanks!

 

 

Stephen Marsh
Community Expert
Community Expert
March 19, 2021

Hi aottke 

 

Firstly, thank you for the offers of a tip, it is greatly appreciated, many don't even bother to come back and provide feeback on the script or say thanks or add a like etc.

 

I'm just a beginner in scripting, I don't have formal study or work experience in programming or in JavaScript. I'm self taught on a need to know basis.

 

I believe that the original code for Contact Sheet II is from a user called Xbytor, who is famous in the Adobe scripting world (think Image Processor Pro, xtools). For somebody unversed in scripting all code may look the same, however, there are big differences. Xbytor's code is very advanced for me, if Contact Sheet II was created by a beginner/intermediate user, I might be able to do something more with it.

 

There are others on this forum who are much further along the scripting path than me, it would be great if they have an idea of where/how to find and make use of the folder/subfolder code.

 

 

Stephen Marsh
Community Expert
Community Expert
March 9, 2021

Run the Contact Sheet II script.

 

Then run the following script. It will save all open docs to PSD into a user selected folder, using the original document name.

 

 

/* 

Save All Open Docs to PSD.jsx
Stephen Marsh 2021

Auto-Save File After Creating Contact Sheet
https://community.adobe.com/t5/photoshop/auto-save-file-after-creating-contact-sheet/td-p/11879020

*/

/* Start Open Document Error Check - Part A: If */
if (app.documents.length > 0) {

    /* Main Code Start */

    (function () {

        // Select the output folder
        var outputFolder = Folder.selectDialog('Please select the save folder:');
        if (outputFolder === null) return;

        // Count open files
        var openFileCount = app.documents.length;

        // Loop through all open docs until no docs are open
        while (app.documents.length > 0) {
            saveOpenDocs();
        }

        // End of script notification
        alert(openFileCount + ' files saved to:' + '\r' + outputFolder.fsName);

        function saveOpenDocs() {
            var docName = app.activeDocument.name;
            var saveFilePSD = new File(new File(outputFolder + '/' + docName + '.psd'));
            SavePSD(saveFilePSD);
            app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

            // Setup PSD options
            function SavePSD(saveFilePSD) {
                psdSaveOptions = new PhotoshopSaveOptions();
                psdSaveOptions.embedColorProfile = true;
                psdSaveOptions.alphaChannels = true;
                psdSaveOptions.layers = true;
                psdSaveOptions.annotations = true;
                psdSaveOptions.spotColors = true;
                app.activeDocument.saveAs(saveFilePSD, psdSaveOptions, true, Extension.LOWERCASE);
            }
        }

    })();

    /* Main Code Finish */
}
/* Finish Open Document Error Check - Part A: If */

/* Start Open Document Error Check - Part B: Else */
else {

    alert('A document must be open to use this script!');

}
/* Finish Open Document Error Check - Part B: Else */

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

aottkeAuthor
Known Participant
March 9, 2021

Thank you so much. Is it possible to save just as a JPG instead? Is it as easy as chanigng all the saveFilePSD to saveFileJPG in the script you shared? And this is a HUGE help by the way...thank you! Seems odd Adobe wouldn't include this ability naturally while they were at it when they created the Contact Sheet II script anyway.

Stephen Marsh
Community Expert
Community Expert
March 9, 2021

Yes, it is possible to save as JPG. I chose PSD as there was no other info so that was the safe choice. You can always use Image Processor script to batch convert PSD to JPG in the short term.


No, it is not as simple as a find/replace to change the script from PSD to JPG as the options are different. There are many example scripts on the site that save to JPG if you wanted to give it a try yourself (which may not be easy eiher).

 

Do you want save as or export save for web to JPG? What options? Can you show a screenshot of the options/settings or describe the various options required (quality level and other settings)?

 

What about the filename, do you want to type in a filename prefix to replace the default ContactSheet prefix before the numering suffix -001, -002 etc?

 

Stephen Marsh
Community Expert
Community Expert
March 8, 2021

A brand new unsaved file has to be provided options when saving (file format and options, location and possibly a new name).

 

This could be automated with a script that saves and closes all open files with a predetermined file type and options.

 

One could automate this into an action or script so that one could select and setup the contact sheet, then auto save/close.

 

 

aottkeAuthor
Known Participant
March 9, 2021

Thank you. I have used the batch process in the past to apply a certain action to a folder of images, and then the act of using the batch process allows for setup of file saving, naming, etc., before starting the batch process, so everything does get saved. Additionally, the saving and closing action can be done as part of the action saved to be run as the batch process it seems. But I can't figure out how to create an action that would automatically save and properly then close all the files irrespective of the exact number of files and folders and subfolders in the parent folder each and every time. In my admittedly limited experience, actions are fairly "dumb" and don't know how many times to do something necessarily based on the number of files in a dynamic way. Do you know how that can be done? I guess with some kind of script? But I'm not familiar with that. Any chance you might know how to do that?