4 Replies Latest reply on Nov 28, 2012 9:58 AM by bret_linford

    Is there a way to export link info (scale %, effective ppi, etc.) to a spreadsheet?

    bret_linford Level 1

      We have several retail pieces that use the same images multiple times. We upsize the image to the largest scale that is used in multiple layouts and then use that same image in the smaller pieces. We'd like to be able to export the link info from several ID layouts to a spreadsheet to compare images and what scale they are needed. This would save time by having to open several files and manually compare scaling, etc.. Any ideas? Thanks!

        • 1. Re: Is there a way to export link info (scale %, effective ppi, etc.) to a spreadsheet?
          emilycurious Level 1

          Not mine, but I don't know who wrote it originally.

           

          Add in your own needs... (i'm still learning JS so I haven't advanced this any further, but I want to add both actual dpi or effective (output size) dpi...)

           

           

          app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

          list = [];

          imgs = app.activeDocument.allGraphics;

          unitname = getCurrentUnit();

          for (i=0; i<imgs.length; i++)

          {

          h = imgs[i].parent.geometricBounds[2] - imgs[i].parent.geometricBounds[0];

          w = imgs[i].parent.geometricBounds[3] - imgs[i].parent.geometricBounds[1];

          left = imgs[i].parent.geometricBounds[1];

          top = imgs[i].parent.geometricBounds[0];

          scale = roundMe(imgs[i].horizontalScale,1);

          // some fair rounding

          switch (unitname)

          {

            case 'in':

             w = roundMe(w, 3);

             h = roundMe(h, 3);

             left = roundMe(left, 3);

             top = roundMe(top, 3);

             break;

            case 'cm':

             w = roundMe(w, 2);

             h = roundMe(h, 2);

             left = roundMe(left, 2);

             top = roundMe(top, 2);

             break;

            default:

             w = roundMe(w, 1);

             h = roundMe(h, 1);

             left = roundMe(left, 1);

             top = roundMe(top, 1);

          }

          list.push (imgs[i].itemLink.name+'\t'+'('+left+','+top+')'+'\t'+w+' x '+h+' '+unitname+'\t'+scale+'%');

          }

          // alert (list.join('\r')); exit();

          defaultFile = new File (Folder.myDocuments+"/"+app.activeDocument.name.replace(/\.indd$/i, '')+".txt");

          if (File.fs == "Windows")

          writeFile = defaultFile.saveDlg( 'Save report', "Plain text file:*.txt;All files:*.*" );

          else

          writeFile = defaultFile.saveDlg( 'Save report');

          if (writeFile != null)

          {

          if (writeFile.open("w"))

          {

            writeFile.encoding = "utf8";

            writeFile.write (list.join("\r")+"\r");

            writeFile.close();

          }

          }

          function roundMe(val,to)

          {

          var t = 1;

          while (to-- > 0) t *= 10;

          return Math.round(val*t)/t;

          }

          function getCurrentUnit ()

          {

          switch (app.activeDocument.viewPreferences.horizontalMeasurementUnits)

          {

            case MeasurementUnits.POINTS: return "pt";

            case MeasurementUnits.PICAS: return "pt";

            case MeasurementUnits.INCHES: return "in";

            case MeasurementUnits.INCHES_DECIMAL: return "in";

            case MeasurementUnits.MILLIMETERS: return "mm";

            case MeasurementUnits.CENTIMETERS: return "cm";

            case MeasurementUnits.CICEROS: return "c";

            case MeasurementUnits.AGATES: return "ag";

            default: alert ("Oh, come on!"); exit(0);

          }

          }

          • 3. Re: Is there a way to export link info (scale %, effective ppi, etc.) to a spreadsheet?
            [Jongware] Most Valuable Participant

            I read it all the way to the end, before encountering one of my signature alerts

             

            The other properties you want are listed in http://jongware.mit.edu/idcs6js/pc_Image.html ; adding this

             

            list.push (imgs[i].itemLink.name+'\t'+'('+left+','+top+')'+'\t'+w+' x '+h+' '+unitname+'\t'+scale+'%'+'\tactual: '+imgs[i].actualPpi+'\teffective: '+imgs[i].effectivePpi);

             

            ought to work.

             

            Both actualPpi and effectivePpi are not a single value, but actually two numbers: horizontal and vertical resolution. They are different if (a) the original image was saveed with non-rectangular pixels (I think -- Photoshop allows this), or (b) the placed image has been stretched out of proportion.

             

            .. (whilst typing this) of course it would be somewhat neater if it only shows the double values when needed ...