Skip navigation
Currently Being Moderated

Script not working with CS6

Jul 23, 2012 7:20 AM

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();

 
Replies
  • Currently Being Moderated
    Jul 23, 2012 7:27 AM   in reply to tlcano

    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();
    
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 2:53 PM   in reply to tlcano

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 10:53 PM   in reply to tlcano

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2012 3:45 AM   in reply to Vamitul

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points