2 Replies Latest reply on Jul 25, 2011 7:54 AM by OlivierBerquin

    Empty  boxes

    JonnyDL Level 1

      I'm buiding doucuments that will have text and images imported into them. Is there a way via Applescript to find the image boxes that have no content in them and somehow indicate they are empty boxes , and not empty space . I have hide frame edges off, and hide guides.

       

      I was thinking of filling them with a fill with a tint, but that wouldn't go away I would need to undo the tint (unless I wrote a script for that)

      putting a smaller tinted box bhind it?

      Help/Suggestions

        • 1. Re: Empty  boxes
          Kasyan Servetsky Level 5

          Here is the approach I would use:

          var doc = app.activeDocument,
          i, rec;
          
          if (doc.swatches.item("-- WARNING --") != null) {
               var swatch = doc.swatches.item("-- WARNING --");
          }
          else {
               var swatch = doc.colors.add({ name:"-- WARNING --", model:ColorModel.PROCESS, space:ColorSpace.CMYK, colorValue:[0, 100, 100, 0] });
          }
          
          for (i = 0; i < doc.rectangles.length; i++) {
               rec = doc.rectangles[i];
               if (rec.images.length == 0) rec.fillColor = swatch;
          }
          

           

          This is not AS because I don't have a Mac at hand, but it should work on Mac as well.

          The script creates a red swatch called "-- WARNING --" and paints all empty image boxes with it. At the end you can remove the swatch replacing it with original color.

           

          Kas

          • 2. Re: Empty  boxes
            OlivierBerquin

            Be careful.
            The proposed solution filled each rectangle with red ... Even those who have a different background color.

            It should therefore be an additional test ...

            Here is a solution is AS:

             

            tell application "Adobe InDesign CS5.5"

                 tell active document

                      try

                           set WarningColor to color "Warning"

                      on error

                           set WarningColor to make color with properties {name:"Warning", model:process, color value:{0, 100, 100, 0}}

                      end try

             

                      set myNoneColor to swatch "None"

                      set fill color of every rectangle whose fill color is myNoneColor to WarningColor

                 end tell

            end tell

            HTH
            Oli.