• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script not working with CS6

New Here ,
Jul 23, 2012 Jul 23, 2012

Copy link to clipboard

Copied

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

}

}

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.exportFile( ExportFormat.JPG, expFile, false );

    };

};

main();

TOPICS
Scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Jul 23, 2012 Jul 23, 2012

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+

...

Votes

Translate

Translate
Advisor ,
Jul 23, 2012 Jul 23, 2012

Copy link to clipboard

Copied

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

}

}

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.exportFile( ExportFormat.JPG, expFile, false );

    };

};

main();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 23, 2012 Jul 23, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2012 Aug 01, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2012 Aug 01, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Aug 01, 2012 Aug 01, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 06, 2012 Aug 06, 2012

Copy link to clipboard

Copied

LATEST

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

}

}

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.exportFile( ExportFormat.JPG, expFile, false );

    };

};

main();

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

thanks

Mattijjah

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines