AccountKiller

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

rcvalle

AccountKiller

Post by rcvalle »

AccountKiller

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

AccountKiller

Post by Mike Hale »

Do you mean an anchor point in a path?. If so the answer is no, not really.

You can not edited paths using a script. It is possible to get all the pathPoints from a path, remove the path, and create an path from that edited info but I have done so only with simple paths with only corner points. I would think it would be much harder to move a smooth point.
rcvalle

AccountKiller

Post by rcvalle »

AccountKiller
Mike Hale

AccountKiller

Post by Mike Hale »

Here is how to edit a point on a path by it's anchor position.

Code: Select allfunction extractSubPathInfo(pathObj,oldPoint,newPoint){
    var pathArray = new Array();
    var pl = pathObj.subPathItems.length;
    for(var s=0;s<pl;s++){
        var pArray = new Array();
          for(var i=0;i<pathObj.subPathItems[s].pathPoints.length;i++){
             pArray = new PathPointInfo;
             pArray.kind = pathObj.subPathItems[s].pathPoints.kind;
         if(pathObj.subPathItems[s].pathPoints.anchor[0]==oldPoint[0] &&
               pathObj.subPathItems[s].pathPoints.anchor[1]==oldPoint[1]){
            pArray.anchor = newPoint;
            pArray.leftDirection = newPoint;
            pArray.rightDirection = newPoint;
         }else{
            pArray.anchor = pathObj.subPathItems[s].pathPoints.anchor;
            pArray[i].leftDirection = pathObj.subPathItems[s].pathPoints[i].leftDirection;
            pArray[i].rightDirection = pathObj.subPathItems[s].pathPoints[i].rightDirection;
         }
          };
        pathArray[pathArray.length] = new Array();
        pathArray[pathArray.length - 1] = new SubPathInfo();
        pathArray[pathArray.length - 1].operation = pathObj.subPathItems[s].operation;
        pathArray[pathArray.length - 1].closed = pathObj.subPathItems[s].closed;
        pathArray[pathArray.length - 1].entireSubPath = pArray;
    };
    return pathArray;
};
var myPathInfo = extractSubPathInfo(app.activeDocument.pathItems.getByName('Path 1'),[334,377],[334,590]);
var myPathItem = app.activeDocument.pathItems.add("myNewPath", myPathInfo);