using indesign menu select all then object pathfinder intersect using script

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

This topic contains 4 replies, has 3 voices, and was last updated by  Ari Singer 4 months, 2 weeks ago.

  • Author
  • #67518

    Abdul Razzak

    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


    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

    Try this:

    var myArray = app.activeWindow.activePage.allPageItems;
    • #85753


      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

      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

      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() {
              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]);
              } catch(myError) {
                  alert("Make sure you selected 2 path items")

You must be logged in to reply to this topic.