6 Replies Latest reply on Aug 6, 2012 3:45 AM by mattijjah

    Script not working with CS6

    tlcano

      Hello-

       

      I am trying to run the following script in ID (CS6) to export grouped items in all open documents as jpegs. Extendscript Toolkit is giving me this error:  "Target Adobe InDesign CS4 (6.0) provides no engine for debugging", and the drop down menu at the top keeps switching from CS6 to CS4. Can anyone see something in the script that would cause that, or is there something else I need to do to get it to work?

       

      Thanks!

      T

       

       

       

      #target indesign

      var saveFold;

        function main(){  

           saveFold = Folder( Folder.desktop + '/Batch' );

              if ( ! saveFold.exists ) { saveFold.create(); }

          var prfs;

       

          prfs = app.jpegExportPreferences;

        

          if ( parseInt( app.version ) >= 7 ) {

       

              prfs.antiAlias = true;

              prfs.embedColorProfile = true;

              prfs.exportResolution = 300;

              prfs.jpegColorSpace = JpegColorSpaceEnum.RGB;

              prfs.jpegQuality = JPEGOptionsQuality.MAXIMUM;

              prfs.simulateOverprint = true;

        

          };

       

          if ( parseInt( app.version ) == 6 ) {

       

                prfs.resolution = 200;

                prfs.jpegQuality = JPEGOptionsQuality.MAXIMUM;

                prfs.jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;

        

          };

         for (var j=0; j<app.documents.length;j++){

      groupsToJPEGs (app.documents[j]);

      }

      }

      function groupsToJPEGs(doc) {

            var i, grps, expFile;

        

       

          grps = doc.groups;

       

          for ( i = 0; i < grps.length; i++ ) {

       

              expFile = File( saveFold + '/'+ doc.name + '_' + ( i + 1 ) + '.jpg' );

              doc.groups[i].exportFile( ExportFormat.JPG, expFile, false );

       

          };

       

      };

       

      main();

        • 1. Re: Script not working with CS6
          Vamitul Level 4

          try this:

           

          var saveFold;
            function main(){  
               saveFold = Folder( Folder.desktop + '/Batch' );
                  if ( ! saveFold.exists ) { saveFold.create(); }
              var prfs;
          
              prfs = app.jpegExportPreferences;
            
             
          
                  prfs.antiAlias = true;
                  prfs.embedColorProfile = true;
                  prfs.exportResolution = 300;
                  prfs.jpegColorSpace = JpegColorSpaceEnum.RGB;
                  prfs.jpegQuality = JPEGOptionsQuality.MAXIMUM;
                  prfs.simulateOverprint = true;
            
             
             for (var j=0; j<app.documents.length;j++){
          groupsToJPEGs (app.documents[j]);
          }
          }
          function groupsToJPEGs(doc) {
                var i, grps, expFile;
            
          
              grps = doc.groups;
          
              for ( i = 0; i < grps.length; i++ ) {
          
                  expFile = File( saveFold + '/'+ doc.name + '_' + ( i + 1 ) + '.jpg' );
                  doc.groups[i].exportFile( ExportFormat.JPG, expFile, false );
          
              };
          
          };
          
          main();
          
          • 2. Re: Script not working with CS6
            tlcano Level 1

            That did it! Thank you so much!!!! XD

            • 3. Re: Script not working with CS6
              tlcano Level 1

              Hi there-

               

              This worked fine for the first batch of test files, but as soon as I tried to demo it for the artist who will be using the script, I got the attached error. I tried it on the same files I tested it with before, so I'm not sure what could cause the issue. Any suggestions? Could the version of ESTK matter (I'm pretty sure I did most of my testing on the CS4 version, but upgraded to CS6 in the meantime).

               

              Thanks!

              T

               

               

              Screen Shot 2012-08-01 at 3.57.37 PM.png

              • 4. Re: Script not working with CS6
                Larry G. Schneider Adobe Community Professional & MVP

                Looks like you might be running it against the ESTK and not InDesign. You might want to put #target indesign as the first line to force it.

                • 5. Re: Script not working with CS6
                  Vamitul Level 4

                  solutions (any will do just fine):

                   

                  1) RUN THE SCRIPT FORM THE SCRIPTS PANEL IN INDESIGN!!

                  2) add #target indesign as the first line in the script

                  3) in ESTK, next to the little green chain icon there is a doprdown list where now it sais "ExtendeScript bla bla". Change it there to Indesign

                  • 6. Re: Script not working with CS6
                    mattijjah

                    Hello

                     

                    I'm trying to work with this script in InD CS3, but I have one problem. Script doesn't read export preferences.

                    I changed script a little (delete part for newest versions) and it looks like that:

                     

                    #target indesign
                    var saveFold;  
                      function main(){    
                         saveFold = Folder( Folder.desktop + '/Batch' );
                            if ( ! saveFold.exists ) { saveFold.create(); }
                        var prfs;
                    
                        prfs = app.jpegExportPreferences;
                               prfs.resolution = 200;
                              prfs.jpegQuality = JPEGOptionsQuality.MAXIMUM;
                              prfs.jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;
                    
                    
                       for (var j=0; j<app.documents.length;j++){
                    groupsToJPEGs (app.documents[j]);
                    }
                    }
                    function groupsToJPEGs(doc) {
                          var i, grps, expFile;
                    
                    
                        grps = doc.groups;
                    
                        for ( i = 0; i < grps.length; i++ ) {
                    
                            expFile = File( saveFold + '/'+ doc.name + '_' + ( i + 1 ) + '.jpg' ); 
                            doc.groups[i].exportFile( ExportFormat.JPG, expFile, false );
                    
                        };
                    
                    };
                    
                    main();
                    

                     

                    Unfortunately scripts gaves me always JPGS with resolution 72dpi. Can you help me somwehow

                     

                    thanks

                    Mattijjah