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

How to apply data sets to 100 documents

Community Beginner ,
Dec 07, 2024 Dec 07, 2024

I have a document with 2 picture frames. I want to apply 200 pictures, 2 on each page. I have the variables set up but how do I do this without going through the list of data sets one by one. Also, how do I then export each document without doing it one by one? Thank you. 

TOPICS
Actions and scripting
334
Translate
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
Adobe
Community Expert ,
Dec 07, 2024 Dec 07, 2024

The official Adobe help page:

 

https://helpx.adobe.com/au/photoshop/using/creating-data-driven-graphics.html

 

The idea is to set up a single template which will be used to create and export the 100 merged two-image documents.

 

You can search these forums or the web for more info, videos etc.

 

Have you set up a comma-separated or tab-delimited text file with the image names and/or paths to import as data sets?

 

You will have two placeholder images layered under the frames, then use pixel-replacement to swap out the placeholder images with the images specified in two columns in the spreadsheet.

 

My blog post shows different methods to get a list of names/paths for use in the spreadsheet. Look under "Manually Acquiring File Names & File Paths"):

 

https://prepression.blogspot.com/2015/04/illustrator-variableimporter-script-tutorial-6.html

 

With an Adobe Bridge script here to copy filenames:

 

https://community.adobe.com/t5/bridge-discussions/copy-filename-to-clipboard/m-p/5968054

 

 

EDIT – Here is a Photoshop script to generate a .txt file of full absolute paths or only image filenames:

2024-12-08_21-16-21.png

/*
Image File List Generator.jsx
Stephen Marsh
v1.0 - 8th December 2024: Initial release
v1.1 - 16th September 2025: Added an option to enclose the text in single or double quotes (helpful for use with ExifTool)
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-apply-data-sets-to-100-documents/td-p/15025966

Created to facilitate the creation of full absolute paths or relative filenames for Variables/Data Driven Graphics
https://helpx.adobe.com/au/photoshop/using/creating-data-driven-graphics.html
https://prepression.blogspot.com/2015/04/illustrator-variableimporter-script-tutorial-6.html
*/

#target photoshop

function createImageFileList(files, folderPath, useFileNameOnly, addQuotes, quoteType) {
    var textFile = new File(folderPath + "/image_file_list.txt");
    textFile.open("w");

    for (var i = 0; i < files.length; i++) {
        var file = files[i];
        if (file instanceof File && file.name.match(/\.(webp|tif|tiff|jpg|jpeg|psd|psb|png)$/i)) {
            var outputString = useFileNameOnly ? file.name : file.fsName;
            if (addQuotes) {
                var q = quoteType === "single" ? "'" : "\"";
                outputString = q + outputString + q;
            }
            textFile.writeln(outputString);
        }
    }

    textFile.close();
    alert("Image file list has been created: " + textFile.fsName);
}

// Create the ScriptUI dialog
var dialog = new Window("dialog", "Image File List Generator (v1.1)");
dialog.orientation = "column";
dialog.alignChildren = "left";
dialog.preferredSize.width = 250;

var panel = dialog.add("panel", undefined, "");
panel.orientation = "column";
panel.alignChildren = "left";
panel.alignment = "fill";

var folderRadio = panel.add("radiobutton", undefined, "Select Folder");
var filesRadio = panel.add("radiobutton", undefined, "Select Files");
folderRadio.value = true;

var useFileNameOnlyCheckbox = panel.add("checkbox", undefined, "Image Filename Only");

var quoteGroup = panel.add("group");
quoteGroup.orientation = "row";
var addQuotesCheckbox = quoteGroup.add("checkbox", undefined, "Enclose in Quotes");
addQuotesCheckbox.helpTip = "Wrap file paths with quotes - useful for OS-specific usage";
var quoteDropdown = quoteGroup.add("dropdownlist", undefined, ["Single (')", 'Double (")']);
quoteDropdown.selection = 0;
quoteDropdown.enabled = false;
// Function to update tooltip based on selection
function updateQuoteHelpTip() {
    quoteDropdown.helpTip = quoteDropdown.selection.index === 0 ? "Macintosh" : "Windows";
}
// Set initial tooltip and update on selection change
updateQuoteHelpTip();
quoteDropdown.onChange = updateQuoteHelpTip;
addQuotesCheckbox.onClick = function () { quoteDropdown.enabled = addQuotesCheckbox.value; };

var buttonGroup = dialog.add("group");
buttonGroup.orientation = "row";
buttonGroup.alignment = "right";

var cancelButton = buttonGroup.add("button", undefined, "Cancel");
var okButton = buttonGroup.add("button", undefined, "OK");

okButton.onClick = function () {
    var useFileNameOnly = useFileNameOnlyCheckbox.value;
    var addQuotes = addQuotesCheckbox.value;
    var quoteType = quoteDropdown.selection.index === 0 ? "single" : "double";

    if (folderRadio.value) {
        var folder = Folder.selectDialog("Select the folder containing the image files");
        if (folder != null) {
            var files = folder.getFiles();
            createImageFileList(files, folder.fsName, useFileNameOnly, addQuotes, quoteType);
        } else {
            alert("No folder selected.");
        }
    } else {
        var files = File.openDialog("Select the image files", true);
        if (files != null && files.length > 0) {
            createImageFileList(files, files[0].parent.fsName, useFileNameOnly, addQuotes, quoteType);
        } else {
            alert("No files selected.");
        }
    }
    dialog.close();
};

cancelButton.onClick = function () { dialog.close(); };

dialog.show();

 

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

Translate
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 ,
Dec 07, 2024 Dec 07, 2024

There are alternatives to using Photoshop's Variables/Data Driven Graphics feature.

 

One option is to use one of the late JJMack's Photo Collage scripts "BatchMultiImageCollage.jsx" with an appropriate template:

 

https://github.com/MarshySwamp/JJMack-Archive

 

PhotoCollageToolkit.zip

 

Translate
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 ,
Dec 07, 2024 Dec 07, 2024

Another option is to use a script to automate the selection and stacking of 2 files into a layered document. 

 

This script can be used to stack in sets of 2 (or more) from a single source folder:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-automate-load-files-into-st...

 

While this script would be used if you had 2 source folders, each with 100 images:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-open-files-and-layer-them/m...

 

Both scripts allow you to select an action to play. You would create the action to move and position the 2 layered images into size and position, add the frames etc.

 

A recent example topic where this helped somebody else with a similar request to yours:

https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-placement-looking-for-help-that...

 

 

Translate
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 ,
Dec 07, 2024 Dec 07, 2024
quote

Also, how do I then export each document without doing it one by one? Thank you. 

By @debbie12345678910

 

If you read the first link (Adobe help article) posted by Stephen_A_Marsh or do a test run, you’ll find that exporting is part of the process already. The Adobe help article says:

quote

Once you've defined the variables and one or more data sets, you can generate batch mode output images using these data set values. The output generated will be in the form of PSD files.

 

Maybe you need final files that are in a format other than PSD. If so, there are multiple ways to export them in the format you actually want, such as batch processing all of those PSD files by (choose one, or something similar):

  • Running them through File > Scripts > Image Processor 
  • Selecting them all in Adobe Bridge and running them through an Export panel preset 
  • Creating a Photoshop action that saves a copy or exports a copy, and running it by choosing the command File > Automate > Batch (this will probably take the most time overall)
Translate
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 ,
Dec 09, 2024 Dec 09, 2024
LATEST

@debbie12345678910 – Sometimes notifications don't work, so I'm just checking in to see if you have seen the replies and if so, how you are doing.

Translate
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