Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Convert Clipping Paths to Frames Loop

Return to Member Forum

  • Author
    Posts
    • #1194903
      Anonymous
      Inactive

      Hi All,

      I have 20+ planograms to complete this week, and to save it being a tedious process by hand (my employer won’t pay for a proper automation program), it’d be awesome if the process could be automated in ID.

      The process being:

      1. Place assets (Jpgs with clipping paths)
      2. Activate clipping paths and convert to frame for all assets, so that I can align / distribute assets in a product family accurately.
      3. Arrange by hand.

      I know the first two steps can be automated, through data merge and scripting but I am a total scripting noob. I can’t even fathom how to put together a loop for the second step. Or even if it’s possible to script out the whole process, minus the arrangement.

      Any tips?

    • #14323799
      David Blatner
      Keymaster

      I think there is a script here on indesignsecrets somewhere that turns on the clipping paths for all images in a document… not sure where to find it, though. Would take some searching.

    • #14323798
      Anonymous
      Inactive

      Thanks David. Before I posted i found this from a user named Kirsten McMillan:

      function resetClippingPath(){
      var allOpenDocs = app.documents;
      for(var m=0;m<allOpenDocs.length;m++){
      var d=allOpenDocs[m];
      var linksIDs = d.links.everyItem().id;
      for(var n=0;n<linksIDs.length;n++){
      try{
      d.links.itemByID(linksIDs[n]).parent.parent.images[0].clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;
      }catch(e){};

      };

      };

      };

      But I’d have no idea how to have it also turn the paths into frames. :/

    • #14323737
      Jeremy Howard
      Participant

      Locky, I believe that this is what you are looking for:

      //—–BEGIN SCRIPT—–//
      for(var x=0;x<app.documents.length;x++){
      var currentDoc = app.documents[x];
      var linksIDs = currentDoc.links.everyItem().id;
      for(var n=0;n<linksIDs.length;n++){
      try{
      currentDoc.links.itemByID(linksIDs[n]).parent.parent.images[0].clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;
      currentDoc.links.itemByID(linksIDs[n]).parent.parent.images[0].clippingPath.convertToFrame();
      }catch(e){};
      };
      };

      //—–END SCRIPT—–//

      The main thing to focus on here is the addition of this line:
      currentDoc.links.itemByID(linksIDs[n]).parent.parent.images[0].clippingPath.convertToFrame();

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
Forum Ads