What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How do i automate this task?


raha

New Member
Messages
3
Likes
0
Hi, I need to automate this whole process.

I have 100 PSD templates and each template has 19 unique text variables.

I need to create 1900 new PSD files having each 1 unique text variable.



1. Open PSD file (i have 100 PSD files in one folder)

2. Select the next variable (i have 19 unique text variables set up in each PSD)

3. Save as new PSD file

4. Open the next PSD file in the folder

5. Repeat the previous task...and so on.



Thanks!
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
Hi raha
Depending on the specifics of your project, it may be doable in Photoshop directly or not (may require a script).
Some questions
- which version of Photoshop
- are these templates just text Layers with each Text Layer having its own assigned variable
- Do you want these 1900 files to have one Text Layer with variable each.

With the a recent version of Photoshop and if it meets the above characteristics there is a way yet does not make sense to outline as there is insufficient user requirements from you on your starting point as well as the ending point you desire.
With more details, forum members will be better able to direct you with suggestions.
Just my quick thoughts.
John Wheeler
 

raha

New Member
Messages
3
Likes
0
Adobe Photoshop Version: 20.0.0 20180920.r.24 2018/09/20: 1193433 x64

each PSD file has one text layer which has a dataset of text variables
yes, each PSD file will have a unique variable in the text layer
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
Hi Raha
I may not have been clear on my questions for the information needed so will outline the approach I would take with the assumptions associated with each. I have not tested this out on as large a problem as you have so this may not solve all of your problems yet hopefully a path to consider.

Note that is process can be done each time on all 19 files or you can do this in one PSD file (thought having 1900 text Layers may be a strain on what Photoshop can do)

- If you are going to try this in one single shot, bring all the PSD files into one PSD file (only the text Layers are needed). Otherwise repeat the below instructions on each of the 19 files
- Make visible and select only the Text Layers (using the Layer panel filter options can help isolate the Layers you want
- The use the File > Export > Layers to Files command
- This command will export each of the Text Layers to its own file. You set the folder location desired and the file name prefix. It uses the text in the Layer for the rest of the file name I believe. You select visible Layers only and I suggest you use "Include ICC Profile" and "Maximize Compatibility"

The above approach will create unique files for each of the Text Layers and the Text Variable associated with each Layer will go along with it.

You may have other nuances or issues that come up so come back for more help if this is insufficient.
Hope this helps
John Wheeler

Screen Shot 2020-06-02 at 9.37.54 AM.png
 

Dormeur74

Power User
Messages
204
Likes
180
My items (text variable) are in a text file (List.txt). The text file and the JSX file must be in the same folder. Try this JSX script:

Code:
#target photoshop                      // MAC Finder ou WINDOWS Explorer (double click)
app.bringToFront();                 // Brings the application to the front
displayDialogs = DialogModes.NO;    // Disables dialog boxes

// Selection of the folder to process
alert("your JSX and TXT files must be in the same folder");
var record="";
var psd_Options  = new PhotoshopSaveOptions(); // [PhotoshopSaveOptions]
psd_Options.layers  = true; // preserves layers
psd_Options.embedColorProfile = true; // preserves the color profile
psd_Options.annotations = true; // preserves annotations
psd_Options.alphaChannels = true; // preserves alpha channels
psd_Options.spotColors = true; // preserves inks

var mainFolder = File($.fileName).path; // The JSX and datas current folder
var inputFolder = Folder.selectDialog("Select the folder where your templates are : ");
var fileList = inputFolder.getFiles(/\.(psd|)$/i);
var outputFolder = Folder(inputFolder + "/save");
if (!outputFolder.exists) outputFolder.create();
var datas = File(mainFolder + "/List.txt");
var dataList = new Array();
datas.open('r');   
var iD = 0;
while(!datas.eof)
{
    record = datas.readln();
    dataList[iD] = record;
    iD++;
}
datas.close();

// If there is no template in the folder : end of process
if (fileList.length==0) {
    alert("There is not any template in this folder.");
}
else {
    main();
}
    
function main() {
    var nbrTemplates = fileList.length;
    var nbrItems = dataList.length
    for (i=0;i<nbrTemplates;i++) {
        var docRef = open(fileList[i]);
        for (j=0;j<nbrItems;j++) {
            docRef.activeLayer=docRef.layers[0];
            docRef.layers[0].textItem.contents = dataList[j];
        var docName = docRef.name;
        var docName  = docName.substring( 0, docName.indexOf('.'));
        var saveFile = File(outputFolder + "/" + docName + "-" + j + 1 + ".psd");
        docRef.saveAs(saveFile, psd_Options);
        }
        docRef.close(SaveOptions.DONOTSAVECHANGES);
    }
}
 

Top