3 Replies Latest reply on Sep 6, 2013 7:50 AM by rriker21

    Clipping paths to varnish layer


      I'm trying to use an applescript that I found for CS2 to copy all images to a varnish layer, apply clipping path, convert to frame, delete image and then fill with color. I will also need to add a stroke and set the object to multiply. I'm thinking it will be better to do that with an object style. I'll put the original script below. I changed CS2 to CS5 but the only result I get is the new layer. Any help would be greatly appreciated.



      tell application "Adobe InDesign CS2" 
      set myDoc to active document 
      tell myDoc 
      make layer with properties {name:"Varnish"} 
      end try 
      set theLinks to every link 
      repeat with i from 1 to count of theLinks 
      set parentID to id of parent of item i of theLinks 
      set oldPath to clipping path of image id parentID 
      if the clipping type of oldPath is photoshop path then 
      set oldGraphic to parent of item i of theLinks 
      set newGraphic to duplicate oldGraphic 
      set properties of newGraphic to {item layer:"Varnish"} 
      set newpath to clipping path of graphic 1 of newGraphic 
      tell newpath 
      set convertPath to convert to frame 
      end tell 
      set properties of convertPath to {fill color:"Magenta"} 
      delete graphic 1 of convertPath 
      end if 
      end repeat 
      end tell 
      end tell
        • 1. Re: Clipping paths to varnish layer
          rriker21 Level 1

          I also found a javascript that works on selected images. It might be better to just loop that through all the images, but I'm not sure how.




          if(app.selection.length == 1){
              mySel = app.selection[0];
              try{myClipping = mySel.graphics[0].clippingPath;
                  if(myClipping.clippingType == ClippingPathType.ALPHA_CHANNEL ||
                      myClipping.clippingType == ClippingPathType.PHOTOSHOP_PATH){
                          alert("Clipping path name: " + mySel.graphics[0].clippingPath.appliedPathName);
                  myFrame = mySel.duplicate(undefined,[0,0]);
                  myFrame.fillColor = app.activeDocument.swatches.item("Registration");
              catch(e){alert("There is no clipping path applied!");}
          • 2. Re: Clipping paths to varnish layer
            Laubender Adobe Community Professional & MVP

            @rriker21 – you first have to gather all graphics in the document and then loop through that array.


            There are two basic problems even with the posted JavaScript:

            1. It will not work as expected with anchored images.

            The shapes will be  at the wrong position.


            2. It may result in unwanted shapes, if:

            2.a The clipping path exceeds the bounds of the placed image

            2.b The image is only visible partly in InDesign and the clipping path exceeds the bounds of the graphic frame that holds the image.


            So, I think that JavaScript must be totally rewritten.



            • 3. Re: Clipping paths to varnish layer
              rriker21 Level 1

              Luckily there are no anchored objects used in my workflow and I'll be going through the layout afterwards to check each page and will edit frames as needed. What would be the best source to learning about gathering the graphics and looping?