Skip to main content
Known Participant
January 8, 2010
Question

opening multiple images

  • January 8, 2010
  • 1 reply
  • 3235 views


Ive converted an Action which opens multiple  (about 60) images into photoshop into Java script.


which creates a rather lengthy result  as it opens each image separately

here is 1 of 60 parts  of a single opened file

// Open
   function step2(enabled, withDialog) {
     if (enabled != undefined && !enabled)
       return;
     var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
     var desc1 = new ActionDescriptor();
     desc1.putPath(cTID('null'), new File("/z/ANIMATION/RendersFolders/BatchLevel_0/Folder1/Face_0001.jpg"));
     executeAction(cTID('Opn '), desc1, dialogMode);


Is there a way in which i can code this to utilize the single path structure, while merely appending each jpg to open

as an example,  something like this?


// Open
   function step2(enabled, withDialog) {
     if (enabled != undefined && !enabled)
       return;
     var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
     var desc1 = new ActionDescriptor();
     desc1.putPath(cTID('null'), new File("/z/ANIMATION/RendersFolders/BatchLevel_0/Folder1/Face_0001.jpg, Face_0002.jpg, Face_0003.jpg, Face_0004.jp"));
     executeAction(cTID('Opn '), desc1, dialogMode);


Can something like this be done?

Thanks for any help

This topic has been closed for replies.

1 reply

Inspiring
January 8, 2010

Is the file list static? If not there are much better ways to open a group of files.

If it is you could modify the step2 function to take a file object or just put the files in an array and loop the array using app.open().

var files = ["/z/ANIMATION/RendersFolders/BatchLevel_0/Folder1/Face_0001.jpg", "/z/ANIMATION/RendersFolders/BatchLevel_0/Face_0002.jpg", "/z/ANIMATION/RendersFolders/BatchLevel_0/Face_0003.jpg", "/z/ANIMATION/RendersFolders/BatchLevel_0/Face_0004.jp"];

for(var f = 0; f < files.length; f++ ){

   app.open( new File( files ) );

}

Known Participant
January 8, 2010

Thanks, Michael

Sorry, I should have mentioned i was a complete noob.
Not sure how to run this.

In the example  provided, I indicated 4 jpeg images.  The final one would contain 60 or more.  Also your code appears to require the path to be duplicated with each occurence..
My objective was to set one path. and indicate this to open 60 files for that given path.

Is it possible to include this alone within a script.?

Could you possibly provide a complete  example that would open say 3 - 4  images, and i could fill in the rest?

Thanks again for the help.

Jeff