22 Replies Latest reply on Jan 3, 2012 4:27 AM by c.pfaffenbichler

    Is possible to separate path using script....?

    yajiv_viki Level 2

      Hi Everyone,

       

      I have one overall path and two outer edge path.

       

      use overall path to separate each like pant and tops.

       

      Is possible to separate path using script. I have also tried script but is not working on second separation.

       

      can any rectify that script is possible...?

       

      -yajiv

      #target Photoshop

      app.bringToFront;

      var docRef = app.activeDocument;

      var myDocname=app.activeDocument.name

      var e=0

      try {

       

          var ecp=docRef.colorProfileName;

           var n=docRef.pathItems.length;

                          if(n>0){

                 

                  if(docRef.pathItems[0].name=="Path 1"){

                    var pathRef = docRef.pathItems[0].duplicate(); 

                   

                    var path1=docRef.pathItems.getByName("1");   

                    //path1.duplicate();         

                    path1.select();

                    Path_copy();

                   

                    var pathitem=docRef.pathItems.getByName("Path 1 copy");

                     pathitem.select();

                     Path_Paste();

                     pathitem.operation = ShapeOperation.SHAPEINTERSECT;

                     Path_Combine();

                  

                     var path1=docRef.pathItems.getByName("1");  

                     var pathRef1 = path1.duplicate();

                     path1.select();

                     path1.remove();

                  

                      var pathitem=docRef.pathItems.getByName("Path 1 copy");

                      pathitem.select();

                      pathitem.name="1";

                                         

                      var pathitem=docRef.pathItems.getByName("Box");

                      pathitem.select();

                      Path_copy();

                     

                     var path1=docRef.pathItems.getByName("1 copy");  

                      path1.select();

                      path1.name="OL"

                      Path_Paste();

                     

                      path1.operation = ShapeOperation.SHAPEXOR;

                      Path_Combine();

                     

                     var pathRef = docRef.pathItems[0].duplicate(); 

                     var pathitem=docRef.pathItems.getByName("Path 1 copy");

                     pathitem.select();

                     Path_copy();

                    

                     var path2=docRef.pathItems.getByName("OL");  

                     path2.select();

                    

                    

                     Path_Paste();

                     path2.operation = ShapeOperation.SHAPEINTERSECT;

                     alert(path2.operation);

                     /*

                     Path_Combine();

                     */

                     

         

                       }

                                    }

         

      }

      catch (e) {

         alert(e);

      //alert ("PSR_LWC_PLUS_V2_PT - Color Profile not Embedded...\n Check it out...!!!")

      };

       

       

      function Path_copy(){

          var id200 = charIDToTypeID( "copy" );

          executeAction( id200, undefined, DialogModes.NO );

         

          }

       

       

      function Path_Paste(){

          var id204 = charIDToTypeID( "past" );

          executeAction( id204, undefined, DialogModes.NO );

          }

       

       

      function Path_Combine(){

                  var idcombine = stringIDToTypeID( "combine" );

                      var desc26 = new ActionDescriptor();

                      var idnull = charIDToTypeID( "null" );

                          var ref25 = new ActionReference();

                          var idPath = charIDToTypeID( "Path" );

                          var idOrdn = charIDToTypeID( "Ordn" );

                          var idTrgt = charIDToTypeID( "Trgt" );

                          ref25.putEnumerated( idPath, idOrdn, idTrgt );

                      desc26.putReference( idnull, ref25 );

                  executeAction( idcombine, desc26, DialogModes.NO );

          }

       

        • 1. Re: Is possible to separate path using script....?
          c.pfaffenbichler Level 9

          I may not quite follow.

          Could you post a screenshot/mock-up to show how the path is currently set up and what paths or selections you want to generate off of it exactly?

           

          I guess it may be necessary to process all of the pathItem’s subPathItems and create new Working Paths from that information; but that should not be too hard to do.

          • 2. Re: Is possible to separate path using script....?
            yajiv_viki Level 2

            Sure!

             

            Please Find my attachment...!

             

            anyone help me to do next step....?

             

            -yajiv

             

            Source.jpg Final.jpg

            • 3. Re: Is possible to separate path using script....?
              c.pfaffenbichler Level 9

              In your original Script why do you select the path »Box«?

                              var pathitem=docRef.pathItems.getByName("Box");

               

              And to ensure the operation goes as planned even with paths that have »holes« maybe you should apply »Path_Combine()« on each path before copying?

              • 4. Re: Is possible to separate path using script....?
                yajiv_viki Level 2

                Hi c.pfaffenbichler,

                 

                I have followed the below mentioned steps.(script also followed by this steps)

                 

                • First I have one Overall Path name as Path1, two outer edge path for seprate overall path like pant & Tops

                       Path "1" for outer edge of Pant.

                       Path "2" for outer edge of Tops.

                       Path "Box" used for invert the all outer edge Path.

                 

                Step 1:

                          Duplicate Path 1 like "Path 1 copy". then Copy "1"  and Paste to "Path1 copy".

                          Intersect all path and Combine like below figure.

                 

                          Ex_Combine.jpg Ex_Combine_Final.jpg

                 

                Step 2.

                          Rename "Path 1 copy" to "Pant". Now Copy "Box" and Paste to "1" then Select path to exculde & Combine like below figure.

                 

                             Step-2.jpg

                 

                Step 3:              

                          Duplicate Path 1 like "Path 1 copy". then Copy "1"  and Paste to "Path1 copy".

                          Intersect all path and Combine like below figure. Remove Path "1" and rename "Path 1 copy" to "OL".

                          OL Path means overall path except Pant part.

                 

                          Step-3.jpgStep-3-1.jpg

                 

                Step 4:

                            Duplicate OL like "OL copy". then Copy "2"  and Paste to "OL copy".

                            Intersect all path and Combine like below figure. Rename "OL copy" to "Tops".

                 

                             Step4.jpgStep4-1.jpg

                 

                Step 5. Now Copy "2" and Paste to "Box" then Select path to exculde & Combine like below figure.

                            and Remove Path "2".  

                 

                             Step5.jpg

                Step 6. Now Copy "Box" and Paste to "OL" then Select path to Intersect & Combine like below figure.

                            and Remove Path "Flesh". & Remove Path "Box".

                               Step6.jpgStep6-1.jpg

                 

                That's It.

                 

                -yajiv

                • 5. Re: Is possible to separate path using script....?
                  c.pfaffenbichler Level 9

                  I wonder if you could streamline the Script some more – but if I understand you correctly and it works in its current incarnation that might be nitpicking.

                   

                  Should you run it on batches of images you could wrap all or parts of the operation in try-clauses to avoid the process stopping in case an image’s paths don’t conform to the naming-convention.

                  • 6. Re: Is possible to separate path using script....?
                    yajiv_viki Level 2

                    Hi c.pfaffenbichler,

                     

                    Can you one do my favuore if Possible..?

                     

                    Is this possible to select Path nodes. Like below image.


                    Select_Nodes.jpg

                     

                    If I select more than one closed and apply Path operation like shapeOperation.SHAPEINTERSECT & combine path.

                     

                         Path_Operation.jpg

                     

                    Thanks in advance.

                     

                    Note: Select all nodes from path not a select path in Path palette.

                     

                    Regards,

                    - yajiv

                    • 7. Re: Is possible to separate path using script....?
                      c.pfaffenbichler Level 9

                      As far as I can tell: no.

                      But one can get the complete path information and create a new Path where one can set the subPathItems to that shapeOperation.

                       

                      Unfortunately this can run into problems with paths that have »holes«.

                       

                      But if I may conjecture on your workflow:

                      One could get the information from the first path (the complete figure) and add the information from the third path (the trousers) and set those to intersect.

                      • 8. Re: Is possible to separate path using script....?
                        yajiv_viki Level 2

                        Hi c.pfaffenbichler,

                         

                        Thanks for your kind reply.

                         

                        I will try to do some modification & slove this script in future.

                         

                        Once again Thanks for your continue support till secs.

                         

                        "Happy New Year...!!!"

                         


                        Regards

                        -yajiv....

                        • 9. Re: Is possible to separate path using script....?
                          c.pfaffenbichler Level 9

                          You could give the Script below a try, but be aware that I have not yet tested it very thoroughly.

                          It would not need a »box«-path; in the screeshot you can see what the resulting paths are for the three original paths.

                          If you want the paths to be combined you could add the function after the creation of each of the resultant paths.

                          createPathIntersectionsScr.jpg

                          // create path intersections;
                          // 2011; use it at your own risk;
                          #target photoshop
                          if (app.documents.length > 0) {
                          var myDocument = app.activeDocument;
                          // set to pixels;
                          var originalRulerUnits = app.preferences.rulerUnits;
                          app.preferences.rulerUnits = Units.POINTS;
                          var theArray = new Array;
                          var theNumber = myDocument.pathItems.length;
                          // »simplify« paths and collect components;
                          for (var m = 0; m < theNumber; m++) {
                                    myDocument.pathItems[m].select();
                                    combinePath();
                                    theArray.push(collectPathComponents(myDocument, myDocument.pathItems[m]));
                                    };
                          // create intersections;
                          for (var n = 1; n < theNumber; n++) {
                                    var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);
                                    var theSecond = theArray[n];
                                    for (var a = 0; a < theSecond.length; a++) {
                                              theFirst.push(theSecond[a])
                                              };
                                    var thePath = createPathFromPathComponentActionDesc(theFirst, "intersect");
                                    makePath("path_"+Math.random());
                                    };
                          // create subtraction;
                          var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);
                          for (var o = 1; o < theNumber; o++) {
                                    var theSecond = theArray[o];
                                    for (var a = 0; a < theSecond.length; a++) {
                                              theFirst.push(theSecond[a])
                                              };
                                    };
                          var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");
                          makePath("path_"+Math.random());
                          // reset;
                          app.preferences.rulerUnits = originalRulerUnits;
                          };
                          ////////////////////////////////////
                          ////////////////////////////////////
                          ////////////////////////////////////
                          function combinePath () {
                          // =======================================================
                          var idcombine = stringIDToTypeID( "combine" );
                              var desc4 = new ActionDescriptor();
                              var idnull = charIDToTypeID( "null" );
                                  var ref3 = new ActionReference();
                                  var idPath = charIDToTypeID( "Path" );
                                  var idOrdn = charIDToTypeID( "Ordn" );
                                  var idTrgt = charIDToTypeID( "Trgt" );
                                  ref3.putEnumerated( idPath, idOrdn, idTrgt );
                              desc4.putReference( idnull, ref3 );
                          executeAction( idcombine, desc4, DialogModes.NO );
                          };
                          //components correspond to subPathItems,  subpathList contains the actual paths than can make up one subPathItem ;
                          ////// collect path infor from actiondescriptor //////
                          function collectPathComponents (myDocument, thePath) {
                          //var myDocument = app.activeDocument;
                          var originalRulerUnits = app.preferences.rulerUnits;
                          app.preferences.rulerUnits = Units.POINTS;
                          // based of functions from xbytor’s stdlib;
                          var ref = new ActionReference();
                          for (var l = 0; l < myDocument.pathItems.length; l++) {
                                    var thisPath = myDocument.pathItems[l];
                                    if (thisPath == thePath && thisPath.name == "Work Path") {
                                              ref.putProperty(cTID("Path"), cTID("WrPt"));
                                              };
                                    if (thisPath == thePath && thisPath.name != "Work Path" && thisPath.kind != PathKind.VECTORMASK) {
                                              ref.putIndex(cTID("Path"), l + 1);
                                              };
                                    if (thisPath == thePath && thisPath.kind == PathKind.VECTORMASK) {
                                  var idPath = charIDToTypeID( "Path" );
                                  var idPath = charIDToTypeID( "Path" );
                                  var idvectorMask = stringIDToTypeID( "vectorMask" );
                                  ref.putEnumerated( idPath, idPath, idvectorMask );
                                              };
                                    };
                          var desc = app.executeActionGet(ref);
                          var pname = desc.getString(cTID('PthN'));
                          // create new array;
                          var theArray = new Array;
                          var pathContents = desc.getObjectValue(cTID("PthC"));
                          var pathComponents = pathContents.getList(sTID('pathComponents'));
                          for (var m = 0; m < pathComponents.count; m++) {
                          var comp = pathComponents.getObjectValue(m);
                          var subPathList = comp.getList(sTID("subpathListKey"));
                          var shapeOp = comp.getEnumerationType(sTID("shapeOperation"));
                          theArray.push([comp, subPathList, shapeOp]);
                          };
                          // by xbytor, thanks to him;
                          function cTID (s) { return cTID[s] || cTID[s] = app.charIDToTypeID(s); };
                          function sTID (s) { return sTID[s] || sTID[s] = app.stringIDToTypeID(s); };
                          // reset;
                          app.preferences.rulerUnits = originalRulerUnits;
                          return theArray;
                          };
                          ////// create a path from an array of pathcomponents //////
                          function createPathFromPathComponentActionDesc (theArray, shapeOperation) {
                          cTID = function(s) { return app.charIDToTypeID(s); };
                          sTID = function(s) { return app.stringIDToTypeID(s); };
                          //
                          var desc1 = new ActionDescriptor();
                          var ref1 = new ActionReference();
                          ref1.putProperty(cTID('Path'), cTID('WrPt'));
                          desc1.putReference(sTID('null'), ref1);
                          var list1 = new ActionList();
                          for (var m = 0; m < theArray.length; m++) {
                                    var desc37 = new ActionDescriptor();
                                    if (m == 0) {
                                              desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr')); 
                                              }
                                    else {
                                              switch (shapeOperation) {
                                                        case "intersect":
                                                        desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr')); 
                                                        break;
                                                        case "subtract":
                                                        desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Sbtr'));
                                                        break;
                                                        default: 
                                                        desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][2]);
                                                        break;
                                                        };
                                              };
                                    var list5 = new ActionList();
                                    desc37.putList(cTID('SbpL'), theArray[m][1]);
                                    list1.putObject(cTID('PaCm'), desc37); 
                                    };
                          desc1.putList(cTID('T   '), list1);
                          executeAction(cTID('setd'), desc1, DialogModes.NO);
                          };
                          ////// make work path regular path //////
                          function makePath (aName) {
                          // =======================================================
                          var idMk = charIDToTypeID( "Mk  " );
                              var desc4 = new ActionDescriptor();
                              var idnull = charIDToTypeID( "null" );
                                  var ref2 = new ActionReference();
                                  var idPath = charIDToTypeID( "Path" );
                                  ref2.putClass( idPath );
                              desc4.putReference( idnull, ref2 );
                              var idFrom = charIDToTypeID( "From" );
                                  var ref3 = new ActionReference();
                                  var idPath = charIDToTypeID( "Path" );
                                  var idWrPt = charIDToTypeID( "WrPt" );
                                  ref3.putProperty( idPath, idWrPt );
                              desc4.putReference( idFrom, ref3 );
                              var idNm = charIDToTypeID( "Nm  " );
                              desc4.putString( idNm, aName );
                          executeAction( idMk, desc4, DialogModes.NO );
                          };
                          
                          • 10. Re: Is possible to separate path using script....?
                            yajiv_viki Level 2

                            Hi

                             

                            That's exactly what I was trying to achieve!

                             

                            Thank you for your time and knowledge, I really do appreciate it.

                             

                            Once again Thanks for your continue support.

                             

                            "Wish you Happy successful New Year - 2012...!!!"

                             


                            Regards

                            -yajiv....

                            • 11. Re: Is possible to separate path using script....?
                              c.pfaffenbichler Level 9

                              I made some small changes, please try this one:

                               

                              // create path intersections;

                              // 2011; use it at your own risk;

                              #target photoshop

                              if (app.documents.length > 0) {

                              var myDocument = app.activeDocument;

                              // set to pixels;

                              var originalRulerUnits = app.preferences.rulerUnits;

                              app.preferences.rulerUnits = Units.POINTS;

                              var theArray = new Array;

                              var theNumber = myDocument.pathItems.length;

                              // »simplify« paths and collect components;

                              for (var m = 0; m < theNumber; m++) {

                                   if (myDocument.pathItems[m].subPathItems.length > 1) {

                                        myDocument.pathItems[m].select();

                                        combinePath();

                                        };

                                   theArray.push(collectPathComponents(myDocument, myDocument.pathItems[m]));

                                   };

                              // create intersections;

                              for (var n = 1; n < theNumber; n++) {

                                   var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);

                                   var theSecond = theArray[n];

                                   for (var a = 0; a < theSecond.length; a++) {

                                        theFirst.push(theSecond[a])

                                        };

                                   var thePath = createPathFromPathComponentActionDesc(theFirst, "intersect");

                                   makePath(myDocument.pathItems[0].name" intersected with "myDocument.pathItems[n].name);

                                   combinePath ()

                                   };

                              // create subtraction;

                              var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);

                              for (var o = 1; o < theNumber; o++) {

                                   var theSecond = theArray[o];

                                   for (var a = 0; a < theSecond.length; a++) {

                                        theFirst.push(theSecond[a])

                                        };

                                   };

                              var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");

                              makePath("all others subtracted from "+myDocument.pathItems[0].name);

                              combinePath ();

                              // reset;

                              app.preferences.rulerUnits = originalRulerUnits;

                              };

                              ////////////////////////////////////

                              ////////////////////////////////////

                              ////////////////////////////////////

                              function combinePath () {

                              // =======================================================

                              var idcombine = stringIDToTypeID( "combine" );

                                  var desc4 = new ActionDescriptor();

                                  var idnull = charIDToTypeID( "null" );

                                      var ref3 = new ActionReference();

                                      var idPath = charIDToTypeID( "Path" );

                                      var idOrdn = charIDToTypeID( "Ordn" );

                                      var idTrgt = charIDToTypeID( "Trgt" );

                                      ref3.putEnumerated( idPath, idOrdn, idTrgt );

                                  desc4.putReference( idnull, ref3 );

                              executeAction( idcombine, desc4, DialogModes.NO );

                              };

                              //components correspond to subPathItems,  subpathList contains the actual paths than can make up one subPathItem ;

                              ////// collect path infor from actiondescriptor //////

                              function collectPathComponents (myDocument, thePath) {

                              //var myDocument = app.activeDocument;

                              var originalRulerUnits = app.preferences.rulerUnits;

                              app.preferences.rulerUnits = Units.POINTS;

                              // based of functions from xbytor’s stdlib;

                              var ref = new ActionReference();

                              for (var l = 0; l < myDocument.pathItems.length; l++) {

                                   var thisPath = myDocument.pathItems[l];

                                   if (thisPath == thePath && thisPath.name == "Work Path") {

                                        ref.putProperty(cTID("Path"), cTID("WrPt"));

                                        };

                                   if (thisPath == thePath && thisPath.name != "Work Path" && thisPath.kind != PathKind.VECTORMASK) {

                                        ref.putIndex(cTID("Path"), l + 1);

                                        };

                                   if (thisPath == thePath && thisPath.kind == PathKind.VECTORMASK) {

                                      var idPath = charIDToTypeID( "Path" );

                                      var idPath = charIDToTypeID( "Path" );

                                      var idvectorMask = stringIDToTypeID( "vectorMask" );

                                      ref.putEnumerated( idPath, idPath, idvectorMask );

                                        };

                                   };

                              var desc = app.executeActionGet(ref);

                              var pname = desc.getString(cTID('PthN'));

                              // create new array;

                              var theArray = new Array;

                              var pathContents = desc.getObjectValue(cTID("PthC"));

                              var pathComponents = pathContents.getList(sTID('pathComponents'));

                              for (var m = 0; m < pathComponents.count; m++) {

                              var comp = pathComponents.getObjectValue(m);

                              var subPathList = comp.getList(sTID("subpathListKey"));

                              var shapeOp = comp.getEnumerationType(sTID("shapeOperation"));

                              theArray.push();

                              };

                              // by xbytor, thanks to him;

                              function cTID (s) { return cTID[s] || cTID[s] = app.charIDToTypeID(s); };

                              function sTID (s) { return sTID[s] || sTID[s] = app.stringIDToTypeID(s); };

                              // reset;

                              app.preferences.rulerUnits = originalRulerUnits;

                              return theArray;

                              };

                              ////// create a path from an array of pathcomponents //////

                              function createPathFromPathComponentActionDesc (theArray, shapeOperation) {

                              cTID = function(s) { return app.charIDToTypeID(s); };

                              sTID = function(s) { return app.stringIDToTypeID(s); };

                              //

                              var desc1 = new ActionDescriptor();

                              var ref1 = new ActionReference();

                              ref1.putProperty(cTID('Path'), cTID('WrPt'));

                              desc1.putReference(sTID('null'), ref1);

                              var list1 = new ActionList();

                              for (var m = 0; m < theArray.length; m++) {

                                   var desc37 = new ActionDescriptor();

                                   if (m == 0) {

                                        desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][1]);

                                        }

                                   else {

                                        switch (shapeOperation) {

                                             case "intersect":

                                             desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr'));     

                                             break;

                                             case "subtract":

                                             desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Sbtr'));

                                             break;

                                             default:

                                             desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][1]);

                                             break;

                                             };

                                        };

                                   var list5 = new ActionList();

                                   desc37.putList(cTID('SbpL'), theArray[m][0]);

                                   list1.putObject(cTID('PaCm'), desc37);     

                                   };

                              desc1.putList(cTID('T   '), list1);

                              executeAction(cTID('setd'), desc1, DialogModes.NO);

                              };

                              ////// make work path regular path //////

                              function makePath (aName) {

                              // =======================================================

                              var idMk = charIDToTypeID( "Mk  " );

                                  var desc4 = new ActionDescriptor();

                                  var idnull = charIDToTypeID( "null" );

                                      var ref2 = new ActionReference();

                                      var idPath = charIDToTypeID( "Path" );

                                      ref2.putClass( idPath );

                                  desc4.putReference( idnull, ref2 );

                                  var idFrom = charIDToTypeID( "From" );

                                      var ref3 = new ActionReference();

                                      var idPath = charIDToTypeID( "Path" );

                                      var idWrPt = charIDToTypeID( "WrPt" );

                                      ref3.putProperty( idPath, idWrPt );

                                  desc4.putReference( idFrom, ref3 );

                                  var idNm = charIDToTypeID( "Nm  " );

                                  desc4.putString( idNm, aName );

                              executeAction( idMk, desc4, DialogModes.NO );

                              };

                              1 person found this helpful
                              • 12. Re: Is possible to separate path using script....?
                                c.pfaffenbichler Level 9

                                Your last reply seems to have failed posting.

                                What was the error?

                                • 13. Re: Is possible to separate path using script....?
                                  yajiv_viki Level 2

                                  Hi,

                                   

                                  If I run the script, Error occur in Line 153: illegal argument - argument 2

                                   

                                  like below mentioned image.

                                   

                                  Error.jpg

                                   

                                   

                                   

                                  Regards

                                  -yajiv

                                  • 14. Re: Is possible to separate path using script....?
                                    c.pfaffenbichler Level 9

                                    It seems the last Script I posted was garbled …

                                    createPathIntersectionsMistake.jpg

                                    It should have been:

                                    // create path intersections;
                                    // 2011; use it at your own risk;
                                    #target photoshop
                                    if (app.documents.length > 0) {
                                    var myDocument = app.activeDocument;
                                    // set to pixels;
                                    var originalRulerUnits = app.preferences.rulerUnits;
                                    app.preferences.rulerUnits = Units.POINTS;
                                    var theArray = new Array;
                                    var theNumber = myDocument.pathItems.length;
                                    // »simplify« paths and collect components;
                                    for (var m = 0; m < theNumber; m++) {
                                              if (myDocument.pathItems[m].subPathItems.length > 1) {
                                                        myDocument.pathItems[m].select();
                                                        combinePath();
                                                        };
                                              theArray.push(collectPathComponents(myDocument, myDocument.pathItems[m]));
                                              };
                                    // create intersections;
                                    for (var n = 1; n < theNumber; n++) {
                                              var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);
                                              var theSecond = theArray[n];
                                              for (var a = 0; a < theSecond.length; a++) {
                                                        theFirst.push(theSecond[a])
                                                        };
                                              var thePath = createPathFromPathComponentActionDesc(theFirst, "intersect");
                                              makePath(myDocument.pathItems[0].name+" intersected with "+myDocument.pathItems[n].name);
                                              combinePath ()
                                              };
                                    // create subtraction;
                                    var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);
                                    for (var o = 1; o < theNumber; o++) {
                                              var theSecond = theArray[o];
                                              for (var a = 0; a < theSecond.length; a++) {
                                                        theFirst.push(theSecond[a])
                                                        };
                                              };
                                    var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");
                                    makePath("all others subtracted from "+myDocument.pathItems[0].name);
                                    combinePath ();
                                    // reset;
                                    app.preferences.rulerUnits = originalRulerUnits;
                                    };
                                    ////////////////////////////////////
                                    ////////////////////////////////////
                                    ////////////////////////////////////
                                    function combinePath () {
                                    // =======================================================
                                    var idcombine = stringIDToTypeID( "combine" );
                                        var desc4 = new ActionDescriptor();
                                        var idnull = charIDToTypeID( "null" );
                                            var ref3 = new ActionReference();
                                            var idPath = charIDToTypeID( "Path" );
                                            var idOrdn = charIDToTypeID( "Ordn" );
                                            var idTrgt = charIDToTypeID( "Trgt" );
                                            ref3.putEnumerated( idPath, idOrdn, idTrgt );
                                        desc4.putReference( idnull, ref3 );
                                    executeAction( idcombine, desc4, DialogModes.NO );
                                    };
                                    //components correspond to subPathItems,  subpathList contains the actual paths than can make up one subPathItem ;
                                    ////// collect path infor from actiondescriptor //////
                                    function collectPathComponents (myDocument, thePath) {
                                    //var myDocument = app.activeDocument;
                                    var originalRulerUnits = app.preferences.rulerUnits;
                                    app.preferences.rulerUnits = Units.POINTS;
                                    // based of functions from xbytor’s stdlib;
                                    var ref = new ActionReference();
                                    for (var l = 0; l < myDocument.pathItems.length; l++) {
                                              var thisPath = myDocument.pathItems[l];
                                              if (thisPath == thePath && thisPath.name == "Work Path") {
                                                        ref.putProperty(cTID("Path"), cTID("WrPt"));
                                                        };
                                              if (thisPath == thePath && thisPath.name != "Work Path" && thisPath.kind != PathKind.VECTORMASK) {
                                                        ref.putIndex(cTID("Path"), l + 1);
                                                        };
                                              if (thisPath == thePath && thisPath.kind == PathKind.VECTORMASK) {
                                            var idPath = charIDToTypeID( "Path" );
                                            var idPath = charIDToTypeID( "Path" );
                                            var idvectorMask = stringIDToTypeID( "vectorMask" );
                                            ref.putEnumerated( idPath, idPath, idvectorMask );
                                                        };
                                              };
                                    var desc = app.executeActionGet(ref);
                                    var pname = desc.getString(cTID('PthN'));
                                    // create new array;
                                    var theArray = new Array;
                                    var pathContents = desc.getObjectValue(cTID("PthC"));
                                    var pathComponents = pathContents.getList(sTID('pathComponents'));
                                    for (var m = 0; m < pathComponents.count; m++) {
                                    var comp = pathComponents.getObjectValue(m);
                                    var subPathList = comp.getList(sTID("subpathListKey"));
                                    var shapeOp = comp.getEnumerationType(sTID("shapeOperation"));
                                    theArray.push([subPathList, shapeOp]);
                                    };
                                    // by xbytor, thanks to him;
                                    function cTID (s) { return cTID[s] || cTID[s] = app.charIDToTypeID(s); };
                                    function sTID (s) { return sTID[s] || sTID[s] = app.stringIDToTypeID(s); };
                                    // reset;
                                    app.preferences.rulerUnits = originalRulerUnits;
                                    return theArray;
                                    };
                                    ////// create a path from an array of pathcomponents //////
                                    function createPathFromPathComponentActionDesc (theArray, shapeOperation) {
                                    cTID = function(s) { return app.charIDToTypeID(s); };
                                    sTID = function(s) { return app.stringIDToTypeID(s); };
                                    //
                                    var desc1 = new ActionDescriptor();
                                    var ref1 = new ActionReference();
                                    ref1.putProperty(cTID('Path'), cTID('WrPt'));
                                    desc1.putReference(sTID('null'), ref1);
                                    var list1 = new ActionList();
                                    for (var m = 0; m < theArray.length; m++) {
                                              var desc37 = new ActionDescriptor();
                                              if (m == 0) {
                                                        desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][1]);
                                                        }
                                              else {
                                                        switch (shapeOperation) {
                                                                  case "intersect":
                                                                  desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr')); 
                                                                  break;
                                                                  case "subtract":
                                                                  desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Sbtr'));
                                                                  break;
                                                                  default: 
                                                                  desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][1]);
                                                                  break;
                                                                  };
                                                        };
                                              var list5 = new ActionList();
                                              desc37.putList(cTID('SbpL'), theArray[m][0]);
                                              list1.putObject(cTID('PaCm'), desc37); 
                                              };
                                    desc1.putList(cTID('T   '), list1);
                                    executeAction(cTID('setd'), desc1, DialogModes.NO);
                                    };
                                    ////// make work path regular path //////
                                    function makePath (aName) {
                                    // =======================================================
                                    var idMk = charIDToTypeID( "Mk  " );
                                        var desc4 = new ActionDescriptor();
                                        var idnull = charIDToTypeID( "null" );
                                            var ref2 = new ActionReference();
                                            var idPath = charIDToTypeID( "Path" );
                                            ref2.putClass( idPath );
                                        desc4.putReference( idnull, ref2 );
                                        var idFrom = charIDToTypeID( "From" );
                                            var ref3 = new ActionReference();
                                            var idPath = charIDToTypeID( "Path" );
                                            var idWrPt = charIDToTypeID( "WrPt" );
                                            ref3.putProperty( idPath, idWrPt );
                                        desc4.putReference( idFrom, ref3 );
                                        var idNm = charIDToTypeID( "Nm  " );
                                        desc4.putString( idNm, aName );
                                    executeAction( idMk, desc4, DialogModes.NO );
                                    };
                                    

                                     

                                    If that is the reason for the error I’m not sure.

                                    The error seems to occur at naming the work path, so it could be about the paths’ names – are they especially long or do they have possibly problematic characters?

                                    Have you removed the »box«-path?

                                    • 15. Re: Is possible to separate path using script....?
                                      yajiv_viki Level 2

                                      Hi,

                                       

                                      Its work fine. after getting result with leak path.

                                      I got one method to rectify above leaks, can you tell is this possible or not.

                                       

                                      As per step your script

                                       

                                      1. Collect information both Overall Path and outer-edge path then Intersect & Combine we get Tops.

                                       

                                      after that we collect information both Overall Path and outer-edge path1 then we Subtract & Combine we get Overall path exclude Tops.

                                       

                                      2. Collect information both Overall path exclude Tops and outer-edge path2 then Intersect & Combine we get Pant.

                                       

                                      again we collect information both Overall path exclude Tops and outer-edge path2 then we Subtract & Combine we get Flesh path.

                                       

                                       

                                      is this possible....?

                                       

                                      Regards,

                                      -yajiv

                                       

                                      Note : I have some modification your code but error happened in Line 97 and 122

                                      Error : General Photoshop Error occurred. This function may not be available in this version of photoshop.

                                       

                                      Err1.jpg

                                       

                                       

                                      Can you rectify this...?

                                      // create path intersections;

                                      // 2011; use it at your own risk;

                                      #target photoshop

                                      if (app.documents.length > 0) {

                                      var myDocument = app.activeDocument;

                                      // set to pixels;

                                      var originalRulerUnits = app.preferences.rulerUnits;

                                      app.preferences.rulerUnits = Units.POINTS;

                                      var theArray = new Array;

                                      var theNumber = myDocument.pathItems.length;

                                      // »simplify« paths and collect components;

                                      for (var m = 0; m < theNumber; m++) {

                                                myDocument.pathItems[m].select();

                                                combinePath();

                                                theArray.push(collectPathComponents(myDocument, myDocument.pathItems[m]));

                                                };

                                            var OV_Path=myDocument.pathItems[0] // modified myself

                                      // create intersections;

                                      for (var n = 1; n < theNumber; n++) {

                                              //alert(OV_Path);

                                                var theFirst = collectPathComponents(myDocument,OV_Path );

                                                var theSecond = theArray[n];

                                                for (var a = 0; a < theSecond.length; a++) {

                                                          theFirst.push(theSecond[a]);

                                                          };

                                       

                                                var thePath = createPathFromPathComponentActionDesc(theFirst, "intersect");

                                                makePath(myDocument.pathItems[0].name+" intersected with "+myDocument.pathItems[n].name);

                                                combinePath();

                                       

                                               var i=1;//modified myself

                                               var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");

                                               makePath("OL_"+i);

                                               OV_Path="OL_"+i;

                                               combinePath();

                                               i=i+1;

                                       

                                                };

                                       

                                       

                                      // create subtraction;

                                      /*

                                      var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);

                                      for (var o = 1; o < theNumber; o++) {

                                                var theSecond = theArray[o];

                                                for (var a = 0; a < theSecond.length; a++) {

                                                          theFirst.push(theSecond[a])

                                                          };

                                                };

                                      var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");

                                      makePath("all others subtracted from "+myDocument.pathItems[0].name);

                                      combinePath();

                                      */

                                      // reset;

                                      app.preferences.rulerUnits = originalRulerUnits;

                                      };

                                      ////////////////////////////////////

                                      ////////////////////////////////////

                                      ////////////////////////////////////

                                       

                                       

                                      function combinePath () {

                                      // =======================================================

                                      var idcombine = stringIDToTypeID( "combine" );

                                          var desc4 = new ActionDescriptor();

                                          var idnull = charIDToTypeID( "null" );

                                              var ref3 = new ActionReference();

                                              var idPath = charIDToTypeID( "Path" );

                                              var idOrdn = charIDToTypeID( "Ordn" );

                                              var idTrgt = charIDToTypeID( "Trgt" );

                                              ref3.putEnumerated( idPath, idOrdn, idTrgt );

                                          desc4.putReference( idnull, ref3 );

                                      executeAction( idcombine, desc4, DialogModes.NO );

                                      };

                                      //components correspond to subPathItems,  subpathList contains the actual paths than can make up one subPathItem ;

                                      ////// collect path infor from actiondescriptor //////

                                      function collectPathComponents (myDocument, thePath) {

                                      //var myDocument = app.activeDocument;

                                      var originalRulerUnits = app.preferences.rulerUnits;

                                      app.preferences.rulerUnits = Units.POINTS;

                                      // based of functions from xbytor’s stdlib;

                                      var ref = new ActionReference();

                                      for (var l = 0; l < myDocument.pathItems.length; l++) {

                                                var thisPath = myDocument.pathItems[l];

                                                if (thisPath == thePath && thisPath.name == "Work Path") {

                                                          ref.putProperty(cTID("Path"), cTID("WrPt"));

                                                          };

                                                if (thisPath == thePath && thisPath.name != "Work Path" && thisPath.kind != PathKind.VECTORMASK) {

                                                          ref.putIndex(cTID("Path"), l + 1);

                                                          };

                                                if (thisPath == thePath && thisPath.kind == PathKind.VECTORMASK) {

                                              var idPath = charIDToTypeID( "Path" );

                                              var idPath = charIDToTypeID( "Path" );

                                              var idvectorMask = stringIDToTypeID( "vectorMask" );

                                              ref.putEnumerated( idPath, idPath, idvectorMask );

                                                          };

                                                };

                                      var desc = app.executeActionGet(ref);

                                      var pname = desc.getString(cTID('PthN'));

                                      // create new array;

                                      var theArray = new Array;

                                      var pathContents = desc.getObjectValue(cTID("PthC"));

                                      var pathComponents = pathContents.getList(sTID('pathComponents'));

                                      for (var m = 0; m < pathComponents.count; m++) {

                                      var comp = pathComponents.getObjectValue(m);

                                      var subPathList = comp.getList(sTID("subpathListKey"));

                                      var shapeOp = comp.getEnumerationType(sTID("shapeOperation"));

                                      theArray.push([comp, subPathList, shapeOp]);

                                      };

                                      // by xbytor, thanks to him;

                                      function cTID (s) { return cTID[s] || cTID[s] = app.charIDToTypeID(s); };

                                      function sTID (s) { return sTID[s] || sTID[s] = app.stringIDToTypeID(s); };

                                      // reset;

                                      app.preferences.rulerUnits = originalRulerUnits;

                                      return theArray;

                                      };

                                      ////// create a path from an array of pathcomponents //////

                                      function createPathFromPathComponentActionDesc (theArray, shapeOperation) {

                                      cTID = function(s) { return app.charIDToTypeID(s); };

                                      sTID = function(s) { return app.stringIDToTypeID(s); };

                                      //

                                      var desc1 = new ActionDescriptor();

                                      var ref1 = new ActionReference();

                                      ref1.putProperty(cTID('Path'), cTID('WrPt'));

                                      desc1.putReference(sTID('null'), ref1);

                                      var list1 = new ActionList();

                                      for (var m = 0; m < theArray.length; m++) {

                                                var desc37 = new ActionDescriptor();

                                                if (m == 0) {

                                                          desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr'));

                                                          }

                                                else {

                                                          switch (shapeOperation) {

                                                                    case "intersect":

                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr'));

                                                                    break;

                                                                    case "subtract":

                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Sbtr'));

                                                                    break;

                                                                    default:

                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][2]);

                                                                    break;

                                                                    };

                                                          };

                                                var list5 = new ActionList();

                                                desc37.putList(cTID('SbpL'), theArray[m][1]);

                                                list1.putObject(cTID('PaCm'), desc37);

                                                };

                                      desc1.putList(cTID('T   '), list1);

                                      executeAction(cTID('setd'), desc1, DialogModes.NO);

                                      };

                                      ////// make work path regular path //////

                                      function makePath (aName) {

                                      // =======================================================

                                      var idMk = charIDToTypeID( "Mk  " );

                                          var desc4 = new ActionDescriptor();

                                          var idnull = charIDToTypeID( "null" );

                                              var ref2 = new ActionReference();

                                              var idPath = charIDToTypeID( "Path" );

                                              ref2.putClass( idPath );

                                          desc4.putReference( idnull, ref2 );

                                          var idFrom = charIDToTypeID( "From" );

                                              var ref3 = new ActionReference();

                                              var idPath = charIDToTypeID( "Path" );

                                              var idWrPt = charIDToTypeID( "WrPt" );

                                              ref3.putProperty( idPath, idWrPt );

                                          desc4.putReference( idFrom, ref3 );

                                          var idNm = charIDToTypeID( "Nm  " );

                                          desc4.putString( idNm, aName );

                                      executeAction( idMk, desc4, DialogModes.NO );

                                      };

                                       

                                      • 16. Re: Is possible to separate path using script....?
                                        c.pfaffenbichler Level 9

                                        What good is the outer edge path?

                                        The paths that circumscribe the person and the various textiles should suffice.

                                        createPathIntersectionEx.jpg

                                         

                                        But maybe I am misuderstanding your procedure – could you illustrate the steps with screenshots or a mock-up?

                                        • 17. Re: Is possible to separate path using script....?
                                          yajiv_viki Level 2

                                          Hi,

                                           

                                          Here I attched video for refernece for Sepration path.

                                           

                                          Thanks in advance.

                                           

                                          Please watch this video....

                                           

                                          https://www.youtube.com/watch?v=xYN-k6N19ag

                                           

                                           

                                          -yajiv

                                          • 18. Re: Is possible to separate path using script....?
                                            yajiv_viki Level 2

                                            Hi,

                                             

                                            Here I attched video for refernece for Sepration path.

                                             

                                            Thanks in advance.

                                             

                                            Please watch this video....

                                             

                                            Note Please copy link & paste to address bar in browser.

                                             

                                            https://www.youtube.com/watch?v=xYN-k6N19ag

                                             

                                            Actually I need to some modification your script.

                                             

                                            As per your script:

                                             

                                            1. We have collect path information include Overall Path and Intersct & Combine Right.

                                             

                                            2. now second step per your script. We have collect include Overall path information and Subtract & Combine Right.

                                             

                                            I need to change this step 2. In subtract menthod..

                                             

                                            We have collect all path information and Add & Combine except Overall path. change mode to exclude. give name to "OL"

                                            1. now duplicate overall path.

                                            2. Copy "OL" & paste to duplicate overall path.

                                            3. now subtract & Combine path we get the result of flesh path.

                                             

                                            is this possible.

                                             

                                            -yajiv

                                            • 19. Re: Is possible to separate path using script....?
                                              c.pfaffenbichler Level 9

                                              1. now duplicate overall path.

                                              2. Copy "OL" & paste to duplicate overall path.

                                              3. now subtract & Combine path we get the result of flesh path.

                                              In the Script you marked out the part

                                              var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);
                                              for (var o = 1; o < theNumber; o++) {
                                                        var theSecond = theArray[o];
                                                        for (var a = 0; a < theSecond.length; a++) {
                                                                  theFirst.push(theSecond[a])
                                                                  };
                                                        };
                                              var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");
                                              makePath("all others subtracted from "+myDocument.pathItems[0].name);
                                              combinePath();
                                              

                                              that should do what you show in the movie you posted regarding a path for everything except the textiles.

                                              Sorry, but I’m afraid I still don’t quite follow the problem.

                                               

                                              Just to make sure (and to run tests) could you post a jpg of one of your images (blank out the layer to avoid copyright issues but keep the paths) on this Forum?

                                              • 20. Re: Is possible to separate path using script....?
                                                yajiv_viki Level 2

                                                Hi,

                                                 

                                                Please modify below mentioned your script as per my instruction.

                                                 

                                                var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);
                                                for (var o = 1; o < theNumber; o++) {
                                                          var theSecond = theArray[o];
                                                          for (var a = 0; a < theSecond.length; a++) {
                                                                    theFirst.push(theSecond[a])
                                                                    };
                                                          };
                                                var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract");
                                                makePath("all others subtracted from "+myDocument.pathItems[0].name);
                                                combinePath();

                                                 

                                                Please change the script below mentioned instruction if you are possible with it...?

                                                 

                                                1. We have collected all paths information and Add & Combine except Overall path. change mode to exclude. give name to "OL"

                                                     add.jpg                                                         Exclude.jpg

                                                 

                                                2. now duplicate overall path.

                                                 

                                                3. Copy "OL" & paste to duplicate overall path.

                                                 

                                                4. now subtract & Combine path we get the result of flesh path.

                                                     Subtract.jpg

                                                5. Finally all path should be exclude mode.

                                                     Exclude.jpg

                                                 

                                                is this possible....?

                                                 

                                                Regards,

                                                    - yajiv

                                                • 21. Re: Is possible to separate path using script....?
                                                  yajiv_viki Level 2

                                                  Hi c.pfaffenbichler,

                                                   

                                                  Finally with your guidance I rectify the script error.

                                                   

                                                  Thank you for your time and knowledge, I really do appreciate it.

                                                   

                                                  Once again Thanks for your continue support.

                                                   

                                                  "Wish you Happy successful New Year - 2012...!!!"

                                                   


                                                  Regards

                                                  -yajiv....

                                                   

                                                   

                                                  Here is the Code.....!

                                                  // create path intersections;

                                                  // 2011; use it at your own risk;

                                                  #target photoshop

                                                  if (app.documents.length > 0) {

                                                  var myDocument = app.activeDocument;

                                                  // set to pixels;

                                                  var originalRulerUnits = app.preferences.rulerUnits;

                                                  app.preferences.rulerUnits = Units.POINTS;

                                                  var theArray = new Array;

                                                  var theNumber = myDocument.pathItems.length;

                                                  // »simplify« paths and collect components;

                                                  for (var m = 0; m < theNumber; m++) {

                                                            myDocument.pathItems[m].select();

                                                            combinePath();

                                                            theArray.push(collectPathComponents(myDocument, myDocument.pathItems[m]));

                                                            };

                                                        var OV_Path=myDocument.pathItems[0]

                                                      // create intersections;

                                                      for (var n = 1; n < theNumber; n++) {

                                                          //alert(OV_Path);

                                                            var theFirst = collectPathComponents(myDocument,OV_Path );

                                                            var theSecond = theArray[n];

                                                            for (var a = 0; a < theSecond.length; a++) {

                                                                      theFirst.push(theSecond[a]);

                                                                      };

                                                            var thePath = createPathFromPathComponentActionDesc(theFirst, "intersect",0);

                                                            makePath(myDocument.pathItems[0].name+" intersected with "+myDocument.pathItems[n].name);

                                                            combinePath();

                                                            };

                                                   

                                                   

                                                  // create subtraction;

                                                      var theFirst = collectPathComponents(myDocument, myDocument.pathItems[0]);

                                                      for (var o = 1; o < theNumber; o++) {

                                                                var theSecond = theArray[o];

                                                                for (var a = 0; a < theSecond.length; a++) {

                                                                          theFirst.push(theSecond[a])

                                                                          };

                                                                };

                                                      var thePath = createPathFromPathComponentActionDesc(theFirst, "subtract",1); // Modify the parameter, add flag for function

                                                      //subtract

                                                      makePath("all others subtracted from "+myDocument.pathItems[0].name);

                                                      combinePath();

                                                   

                                                   

                                                  // reset;

                                                  app.preferences.rulerUnits = originalRulerUnits;

                                                  };

                                                  ////////////////////////////////////

                                                  ////////////////////////////////////

                                                  ////////////////////////////////////

                                                   

                                                   

                                                      function combinePath () {

                                                      // =======================================================

                                                      var idcombine = stringIDToTypeID( "combine" );

                                                          var desc4 = new ActionDescriptor();

                                                          var idnull = charIDToTypeID( "null" );

                                                              var ref3 = new ActionReference();

                                                              var idPath = charIDToTypeID( "Path" );

                                                              var idOrdn = charIDToTypeID( "Ordn" );

                                                              var idTrgt = charIDToTypeID( "Trgt" );

                                                              ref3.putEnumerated( idPath, idOrdn, idTrgt );

                                                          desc4.putReference( idnull, ref3 );

                                                      executeAction( idcombine, desc4, DialogModes.NO );

                                                      };

                                                      //components correspond to subPathItems,  subpathList contains the actual paths than can make up one subPathItem ;

                                                      ////// collect path infor from actiondescriptor //////

                                                      function collectPathComponents (myDocument, thePath) {

                                                          //var myDocument = app.activeDocument;

                                                          var originalRulerUnits = app.preferences.rulerUnits;

                                                          app.preferences.rulerUnits = Units.POINTS;

                                                          // based of functions from xbytor’s stdlib;

                                                          var ref = new ActionReference();

                                                          for (var l = 0; l < myDocument.pathItems.length; l++) {

                                                                    var thisPath = myDocument.pathItems[l];

                                                                    if (thisPath == thePath && thisPath.name == "Work Path") {

                                                                              ref.putProperty(cTID("Path"), cTID("WrPt"));

                                                                              };

                                                                    if (thisPath == thePath && thisPath.name != "Work Path" && thisPath.kind != PathKind.VECTORMASK) {

                                                                              ref.putIndex(cTID("Path"), l + 1);

                                                                              };

                                                                    if (thisPath == thePath && thisPath.kind == PathKind.VECTORMASK) {

                                                                 // var idPath = charIDToTypeID( "Path" );

                                                                  var idPath = charIDToTypeID( "Path" );

                                                                  var idvectorMask = stringIDToTypeID( "vectorMask" );

                                                                  ref.putEnumerated( idPath, idPath, idvectorMask );

                                                                              };

                                                                    };

                                                           var desc = app.executeActionGet(ref);

                                                          var pname = desc.getString(cTID('PthN'));

                                                          // create new array;

                                                          var theArray = new Array;

                                                          var pathContents = desc.getObjectValue(cTID("PthC"));

                                                          var pathComponents = pathContents.getList(sTID('pathComponents'));

                                                          for (var m = 0; m < pathComponents.count; m++) {

                                                          var comp = pathComponents.getObjectValue(m);

                                                          var subPathList = comp.getList(sTID("subpathListKey"));

                                                          var shapeOp = comp.getEnumerationType(sTID("shapeOperation"));

                                                          //alert("shapeOp - "+shapeOp);    q

                                                          theArray.push([comp, subPathList, shapeOp]);

                                                          };

                                                   

                                                   

                                                          // by xbytor, thanks to him;

                                                          function cTID (s) { return cTID[s] || cTID[s] = app.charIDToTypeID(s); };

                                                          function sTID (s) { return sTID[s] || sTID[s] = app.stringIDToTypeID(s); };

                                                          // reset;

                                                          app.preferences.rulerUnits = originalRulerUnits;

                                                          return theArray;

                                                      };

                                                   

                                                   

                                                      ////// create a path from an array of pathcomponents //////

                                                      function createPathFromPathComponentActionDesc (theArray, shapeOperation,flag) {

                                                      cTID = function(s) { return app.charIDToTypeID(s); };

                                                      sTID = function(s) { return app.stringIDToTypeID(s); };

                                                      //

                                                      var desc1 = new ActionDescriptor();

                                                      var ref1 = new ActionReference();

                                                      ref1.putProperty(cTID('Path'), cTID('WrPt'));

                                                      desc1.putReference(sTID('null'), ref1);

                                                      var list1 = new ActionList();

                                                   

                                                      for (var m = 0; m < theArray.length; m++) {

                                                                var desc37 = new ActionDescriptor();

                                                                if (m == 0 && flag=0) {

                                                                          desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr'));

                                                                          }

                                                                else  if (m == 0 && flag=1) {//Modify mode to exclude.....!

                                                                           desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][2]);

                                                                    }                 

                                                                else {

                                                                          switch (shapeOperation) {

                                                   

                                                                                    case "intersect":

                                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Intr'));

                                                                                    break;

                                                                                    case "subtract":

                                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), cTID('Sbtr'));

                                                                                    break;

                                                                                    case "exclude":

                                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), 696);

                                                   

                                                                                    default:

                                                                                    desc37.putEnumerated(sTID('shapeOperation'), sTID('shapeOperation'), theArray[m][2]);

                                                                                    break;

                                                                                    };

                                                                          };

                                                                var list5 = new ActionList();

                                                                desc37.putList(cTID('SbpL'), theArray[m][1]);

                                                                list1.putObject(cTID('PaCm'), desc37);

                                                                };

                                                      desc1.putList(cTID('T   '), list1);

                                                      executeAction(cTID('setd'), desc1, DialogModes.NO);

                                                      };

                                                   

                                                   

                                                      ////// make work path regular path //////

                                                      function makePath (aName) {

                                                      // =======================================================

                                                      var idMk = charIDToTypeID( "Mk  " );

                                                          var desc4 = new ActionDescriptor();

                                                          var idnull = charIDToTypeID( "null" );

                                                              var ref2 = new ActionReference();

                                                              var idPath = charIDToTypeID( "Path" );

                                                              ref2.putClass( idPath );

                                                          desc4.putReference( idnull, ref2 );

                                                          var idFrom = charIDToTypeID( "From" );

                                                              var ref3 = new ActionReference();

                                                              var idPath = charIDToTypeID( "Path" );

                                                              var idWrPt = charIDToTypeID( "WrPt" );

                                                              ref3.putProperty( idPath, idWrPt );

                                                          desc4.putReference( idFrom, ref3 );

                                                          var idNm = charIDToTypeID( "Nm  " );

                                                          desc4.putString( idNm, aName );

                                                      executeAction( idMk, desc4, DialogModes.NO );

                                                      };


                                                  • 22. Re: Is possible to separate path using script....?
                                                    c.pfaffenbichler Level 9

                                                    I have been busy today, so I had not read your last post fully – but if I understand correctly that is moot now and you can automate your intended task yourself?