2 Replies Latest reply on Jan 25, 2018 3:02 AM by Kukurykus

    Multiple images imported into smart object and saved

    alex_ma

      Hello,

       

      I have a folder with 100+ images and a mock-up template with smart object. My question is how to import 100+ into the smart object and save them creating 100+ different images?

      I don't know if I need a script for that so I will appreciate if someone can help. Thanks in advance

       

      Kind regards,

       

      Alex

        • 2. Re: Multiple images imported into smart object and saved
          Kukurykus Adobe Community Professional

          I'm not sure is that you wanted so just try it and we'll work out something:

           

          function sTT(v) {return stringIDToTypeID(v)}
          
          function dup(v) {
               (ref1 = new ActionReference()).putEnumerated
               (sTT('layer'), sTT('ordinal'), sTT('targetEnum'));
               (dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
               (ref2 = new ActionReference()).putIndex(sTT('document'), v)
               dsc1.putReference(sTT('to'), ref2), executeAction
               (sTT('duplicate'), dsc1, DialogModes.NO)
          }
          
          (sub = Folder((fls = Folder.selectDialog('Select folder:')
          .getFiles(/.jpe?g/i))[0].path + '/Processed')).create()
          executeAction(sTT('placedLayerEditContents'))
          
          function fD(v) {activeDocument=doc[v]}; for(i=0;i<fls.length;i++) {
               open(fls[i]), dup(2), doc = documents, fD(1), doc[1].save(), fD(0)
               doc[0].saveAs(File(sub + '/' + doc[2].name)), doc[2].close(), fD(1)
               doc[1].activeHistoryState = (hS = doc[1].historyStates)[hS.length - 2]
          }
          
          while(doc.length) activeDocument.close(SaveOptions.DONOTSAVECHANGES)
          

           

          Just open your .psd file containing smart object, then run script. It prompts you to choose folder containing 100+ files. Then it opens each file (change jpe?g to appropiate format in script, before you run it !), put to smart object as top level layer and save as smart object in new .psd file with original (jpg / other) file name of (self-created) subfolder that is in 100+ files folder.