3 Replies Latest reply on Jan 22, 2013 3:00 AM by phillipwork

    Clipping path script

    phillipwork Level 1

      Hi all,


      I would like to know if there is a script solution that automatticly aplies a clipping path throughout the whole document instead of selection each container by hand and choose Path 1.




        • 1. Re: Clipping path script
          Kasyan Servetsky Level 5

          Here is a script which resets clipping paths to "None", but you can simply change ClippingPathType.NONE to ClippingPathType.PHOTOSHOP_PATH and set appliedPathName to "Path 1".


          I can't test it myself at the moment, but I hope it will work:


          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
          app.doScript(resetAllClippingPathsToActiveDoc, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Reset all Clipping Paths of the Active Document");
          function resetAllClippingPathsToActiveDoc(){
              var d=app.activeDocument;
              var allGraphicsInDoc = d.allGraphics;
              for(var n=0;n<allGraphicsInDoc.length;n++){
                      allGraphicsInDoc[n].clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;
                      allGraphicsInDoc[n].clippingPath.appliedPathName = "Path 1";
          • 2. Re: Clipping path script
            phillipwork Level 1

            Thanks Kasyan,


            But i had a syntax error on yours. But in the topic i used the following script. It does what is need to do but Indesign crashes. Do you got any idea?




            app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;


            app.doScript(resetAllClippingPathsToNone, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Reset all Clipping Paths of all open Documents to None");


            function resetAllClippingPathsToNone(){


            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++){



                            d.links.itemByID(linksIDs[n]).parent.parent.graphics[0].clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;








            • 3. Re: Clipping path script
              phillipwork Level 1

              Indesign doenst crashes if i copy paste some containers of pictures to a new document.