InDesign CS2 convert clipping paths to varnish plate

this will convert clipping paths around an image to a varnish plate without disturbing the original image or clipping path. the only problem i’ve had is that i can’t find a way to limit the path to only the part of the image that’s visible; if the initial image is clipped in a frame, it still converts the whole image so that you have to go in and edit the path later. anyone have any insight on how to make it clip to the frame?

cheers
ray.

-- ID CS2 Clipping Path to Varnish Plate
-- 2007 Ray Massie & Chad Augur
-- with much help from macscripter.net and page-online.de forums


tell application "Adobe InDesign CS2"
   
   set myDoc to active document
   
   tell myDoc
       
       try
           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

I’m away from work and home so I can’ t look into this right now, but I think that you can do pathfinder functions through scripts in ID. If so then you can create the path for the varnish plate, then create a duplicate of the picture box, then do an intersection function on the two shapes which should give you the desired result.

ah… good idea… i’ll try to work on that…