Skip to main content
Inspiring
November 21, 2011
Answered

(cross post) Batch of two folders in...

  • November 21, 2011
  • 2 replies
  • 2244 views

I have two folders with image sequences. I would like to run a batch of some sort, which opens one file from each folder, copies one of the images into a new layer of the other, then saves the results to a new folder, and continues.

Is this possible? How?

ty

p.s. I am on Mac OSX Lion 10.7.2 with CS5

This topic has been closed for replies.
Correct answer William_Donelson

Paste the copied code into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS4 or /Applications/Utilities/Adobe Utilities-CS5/ExtendScript Toolkit CS5) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, (in CS4 and CS5) be used in a Configurator-Panel or started from ExtendScript Toolkit directly.

But if you aren’t in a hurry you may want to wait a bit, because I seem to remember there were threads and Scripting solutions offered to two-folder-tasks that may fit your needs better – I can’t currently locate them, but maybe one of their creators might drop by yet and provide the code or a link.


C. thanks again.

I found I can place the .jsx file into that scripts folder on my disk and then use "File > Scripts > Browse" to run it.

However, one image sequence is .png and the other is .tif, so will have to add some code, which I think I can do, to fix it.

Cheers

William

#target photoshop

var inputFolderA = Folder.selectDialog("Please select ImageA folder");  

var inputFolderB = Folder.selectDialog("Please select ImageB folder");  

var outputFolderE = Folder.selectDialog("Please select output Folder ImageE folder"); 

var fileList = inputFolderA.getFiles ("*.png");

var startRulerUnits = preferences.rulerUnits;

preferences.rulerUnits = Units.PIXELS;

for (var a = 0;a<fileList.length;a++){

          var file =fileList;

          var fileB = file.name.replace(/A/,"B");

          fileB = file.name.replace(/png/,"tif");

          var doc = open(file);

          var Bimage = File(inputFolderB +"/" + fileB);

          if(Bimage.exists) {

             var b = open(Bimage);

             activeDocument.selection.selectAll();

             activeDocument.selection.copy();

             app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

             activeDocument.paste();

          }

          var saveFile = File(outputFolderE +"/" +file.name.replace(/A/,"E"));

          SavePSD(saveFile);

          app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

}

app.preferences.rulerUnits = startRulerUnits;

function SavePSD(saveFile){

psdSaveOptions = new PhotoshopSaveOptions();

psdSaveOptions.embedColorProfile = true;

psdSaveOptions.alphaChannels = true; 

activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);

}

mikel28071654
Participant
March 12, 2015

Hello,

I have tried to use your code above, where I have a sequence of files in a Left folder and a sequence of files in a Right folder. The goal is to open the left image (L_001) and place the right image (R_001) on top, by creating a new layer. Then save the two layered image as a PSD. Then to carry on, L & R _002, 003, so on.

Can you advise me on what piece of the code should be changed?

Thanks!

c.pfaffenbichler
Community Expert
Community Expert
November 22, 2011

Maybe this can help:

http://ps-scripts.com/bb/viewtopic.php?f=9&t=2543&start=0&hilit=combine+two+folders&sid=f395b49f2097e6af63939d604090c91b

What are the naming conventions in the two folders or how can the associated files be identified?

Inspiring
November 22, 2011

C. thanks very much!

That looks eminently modifyable into what I want.

Can you point me to a tutorial on how to turn this text into a script in Mac CS5 (v12.1 64-bit) ?

c.pfaffenbichler
Community Expert
Community Expert
November 22, 2011

Paste the copied code into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS4 or /Applications/Utilities/Adobe Utilities-CS5/ExtendScript Toolkit CS5) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, (in CS4 and CS5) be used in a Configurator-Panel or started from ExtendScript Toolkit directly.

But if you aren’t in a hurry you may want to wait a bit, because I seem to remember there were threads and Scripting solutions offered to two-folder-tasks that may fit your needs better – I can’t currently locate them, but maybe one of their creators might drop by yet and provide the code or a link.