• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Auto-Save File After Creating Contact Sheet

Community Beginner ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

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...

TOPICS
Actions and scripting

Views

1.1K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 12, 2021 Mar 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 o

...

Likes

Translate

Translate
Community Expert ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

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.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

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

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

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?

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

Just saving at quality 10 would be fine... If the file name could be the parent folder/sub-folder name, that would be ideal. But if that's too complicated, just the standard default is fine. I'm already getting so much help from you this is already amazing. And now I see how to install the script from your answer below. I missed that at the bottom and got carried away with the instructions at the top of that post. But now I think I can do that...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

OK 10 quality... But what about:

 

* ICC profile inclusion?

* Baseline (Standard), Baseline Optimised or Progressive?

* If progressive, how many scans (3,4,5)?

 

I prefer to know than presume/guess what is required.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

I can't get the input directory/sub-folders from the first script and use them in the second script for the filename.

 

What I can do is offer a prompt for you to type in the new name, or let you select the folder yourself for the name.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

I am also getting the following error in Apple Script Editor:

 

A “/” can’t go here.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

The code is cross platform JavaScript, not AppleScript.

 

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

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2021 Mar 10, 2021

Copy link to clipboard

Copied

It is "easy enough" to insert my script into the Contact Sheet II script so that it will work as a single step.

 

This will allow unattended saving, once the contact sheet has been set you can walk away and come back with all of the files automatically saved.

 

I'm still looking into having the saved files use the input folder name, it's somewhere in the 12,000 lines of code...

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

Man...you're incredible. I'm sorry for the late responses. I thought Adobe was emailing me when there was a reponse to check on this thread, but I guess not...

 

Anyway, that would be amazing to combine into one somehow. I would say automating so it's a click-and-walk-away process is 100% the goal. So take this with a grain of salt, but if we could then just call the filename ContactSheet or something like that, that'd be fine. Ideally it would just save in the same location from where it's pulling the files from. Is that possible? So at least the resulting file is saved in the same subfolder alongside the files that were used to make it?

 

ICC profile isn't that important for this in particular, but may as well include it. And then Baseline (Standard). Does that work?

 

If this all actually works in the end, I really need to venmo you a little something for all the help...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

This version of the PSD code saves JPEG's:

 

/* 

Save All Open Docs to JPG.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.replace(/\.[^\.]+$/, '');
            var saveFileJPG = new File(new File(outputFolder + '/' + docName + '.jpg'));
            saveJPG(saveFileJPG);
            app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

            // Setup JPG options
            function saveJPG(saveFileJPG) {
                var jpgOptions = new JPEGSaveOptions();
                jpgOptions.formatOptions = FormatOptions.STANDARDBASELINE;
                jpgOptions.embedColorProfile = true;
                jpgOptions.matte = MatteType.NONE;
                jpgOptions.quality = 10;
                app.activeDocument.saveAs(saveFileJPG, jpgOptions, 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 */

 

Combining this into the standard code will follow.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

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-...

 

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Thank you so much. This worked like a charm! But yes, would be more useful to put into each subfolder. If you or anyone else figures that out in the future, please let me know 🙂 I would like to still get you a meal or something (through Venmo) or whatever I can do (and will help whoever solves the subfolder saving issue as well). Can I find you on there somehow?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

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!

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

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.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

Hello @Stephen_A_Marsh, Your code here is great! Can I ask you a question? How would you save a contact sheet automatically as a transparent .PNG file (with the white background turned off)? Thanks!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

@jeremyz90087598 thanks!

 

The first step would be to untick the flatten checkbox in the script interface.

 

You can create an action to delete the Background layer.

 

You can run the action on all open files using the File > Automate > Batch command.

 

You could also use the script previously posted for saving all open files to PSD. Then use Batch to save to PNG retaining transparency. Or the script could be rewritten to save to transparent PNG, just like the JPEG version was created as an offshoot of the PSD script. Finally, the extended version of the Contact Sheet II script which I modified to automatically save JPEG files could also be updated to delete the Background and save transparent PNG.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 18, 2022 Oct 18, 2022

Copy link to clipboard

Copied

Thank you so much. this is great!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2022 Oct 18, 2022

Copy link to clipboard

Copied

LATEST

You're welcome.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines