Clipping Paths in whol Document

Viewing 1 reply thread
  • Author
    Posts
    • #98122
      Tom Tramita
      Member

      Hey, Guys,

      Im really sorry if this is solved topic already, but could someone help me with functionality of this script? It looks like it works fine but it shows that no clipping path is avaible, even when there are clipping paths with the same name in every picture of the document.

      Script:

      main();
      function main(){

      var
      i, j, allGraphics,
      allGraphicsArrays = app.activeDocument.pages.everyItem().allGraphics;

      for (var i=0; i<allGraphicsArrays.length; i++) {
      var myObject = allGraphicsArrays[i];
      for (j=0; j<myObject.length; j++) {
      try{

      myObject.pageItems.item(0).clippingPath.appliedPathName = myObject.pageItems.item(0).clippingPath.photoshopPathNames[0];
      myObject.pageItems.item(0).clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;

      }
      catch (myError) {
      // If it can’t apply the Photoshop path then it obviously does not have one
      alert(“Selected image does not have a Photoshop path applied”)
      }
      }
      }
      }

    • #98139
      Tom Tramita
      Member

      I found it out!
      I think the “pageItems.item was not defined totaly, so here is the working one!

      Script:

      main();
      function main(){

      var i, j, allGraphics,
      allGraphicsArrays = app.activeDocument.pages.everyItem().allGraphics;

      for (var i=0; i<allGraphicsArrays.length; i++) {
      var myObject = allGraphicsArrays[i];
      for (var j=0; j<myObject.length; j++) {
      try{

      myObject[j].clippingPath.appliedPathName = myObject[j].clippingPath.photoshopPathNames[0];
      myObject[j].clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;

      }
      catch (myError) {
      alert(“Selected image does not have a Photoshop path applied”)
      }
      }}
      }

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
>