using indesign menu select all then object pathfinder intersect using script

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / using indesign menu select all then object pathfinder intersect using script

Viewing 2 reply threads
  • Author
    Posts
    • #67518
      Abdul Razzak
      Member

      i want to execute indesign menu options in sequence using script. i.e first edit – > select all . then object -> pathfinder -> intersect. How do i do that using script.

    • #85621
      Matt Isaac
      Participant

      does anyone have a solution to this? I am working on writing my first script and would like to add pathfinder to it.

    • #85749
      Ari Singer
      Member

      Try this:

      var myArray = app.activeWindow.activePage.allPageItems;
      myArray[0].intersectPath(myArray);
      
      • #85753
        Matt Isaac
        Participant

        I am trying to use the subtract option with two objects. My current script code is:

        function main(){
        var mySelections = app.selection;
        var bottomObject = mySelections[0];
        var cutLine = mySelections[1];
        var topObject = bottomObject.duplicate();
        var topPath = topObject && cutLine;
        }
         

        Which works to duplicate the bottom object but now i need to use the subtract pathfinder option for the topObject and cutLine (topPath). I am trying to script a solution for my post in https://creativepro.com/topic/cut-photo-in-half-along-curved-path

        I tried using your bit of code in my script changing a few things to topPath[0].subtractPath(topPath); but it didn’t work.
        maybe you can once again improve upon my idea =).

      • #85764
        Ari Singer
        Member

        Skemicle, the ‘and’ operator (‘&&’) is an equality operator, not an assignment operator.

        This script should work:

        app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Subtract Paths");
        function main() {
            try{
                var mySelection = app.selection;
                var myPicture = mySelection[0];
                var myPath = mySelection[1];
                var topPicture = myPicture.duplicate();
                var half1 = myPath.subtractPath(myPicture);
                var newPath = half1.duplicate();
                var half2 = newPath.subtractPath(topPicture);
                var myGroup = half1.parent.groups.add ([half1, half2]);
                app.select(myGroup);
                } catch(myError) {
                    alert("Make sure you selected 2 path items")
                    }
                }
        
Viewing 2 reply threads
  • You must be logged in to reply to this topic.
>