2 Replies Latest reply on Jul 25, 2011 11:49 AM by C_Compton1a

    Im a little lost,

    C_Compton1a

      Hey Im a n00b to adaobe script, but im a fast learner, Ive been trying to reverse engineer some scripts that I found to make one that will,

       

      1. Run an action

      2. append file name

      3. Save to folderX

      4. Run an action

      5. append file name

      6. Save to folderX

      7. Run an action

      8. append file name

      9. Save to folderX

      10. Run an action

      11. append file name

      12. Save to folderX

       

      .....All to the same single open file, (or batch to a folder full of images, but that comes later).

       

      Ive been hacking at this ( I know there are some superfluous functions, but they dont matter), and I was making some headway,  but all of a sudden photoshop just keeps telling me " JavaScript code was missing"

       


      main();
      function main(){
      if(!documents.length) return;
      var prefA ="A_";
      var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
      var res = activeDocument.resolution;
      var Path = "~/Volumes/Data/Pictures";
      if(res != 300) app.activeDocument.resizeImage( undefined, undefined, 300, ResampleMethod.NONE );
      doAction("A- 3600x2400","Set 1")
      var saveFile = File(Path+"/"+prefA+Name+".jpg");

       

      SaveJPEG(saveFile, 12);
      saveFile = File(Path+"/"+"A_"+Name+".jpg");
      SaveJPEG(saveFile, 4);
      app.activeDocument.resizeImage( undefined, new UnitValue(5,'cm'), 96, ResampleMethod.BICUBIC );
      saveFile = File(Path+"/"+Name+"FORMATTN.jpg");
      SaveJPEG(saveFile, 4);
      Un-comment to close document
      activeDocument.close(SaveOptions.SAVECHANGES);
      }

       

      function SaveJPEG(saveFile, jpegQuality){
      jpgSaveOptions = new JPEGSaveOptions();
      jpgSaveOptions.embedColorProfile = true;
      jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
      jpgSaveOptions.matte = MatteType.NONE;
      jpgSaveOptions.quality = jpegQuality; //1-12
      activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
      }

       

      Could some one help a n00by out??

       

      what happened

       

       

      (Photoshop CS5 on a Mac btw)