Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #target photoshop
- var origUnits = app.preferences.rulerUnits;
- app.preferences.rulerUnits = Units.PIXELS;
- var activeDoc = app.activeDocument;
- if (typeof activeDoc.path == 'undefined') {
- var myPath='c:';
- } else {
- var myPath = app.activeDocument.path;
- }
- filePath = myPath + '/path_coords.txt';
- var f = new File(filePath);
- f.open('w');
- for (i=0;i<activeDoc.pathItems.length;i++) {
- var myPathItem = activeDoc.pathItems[i];
- for (j=0;j<myPathItem.subPathItems.length;j++) {
- var mySubPathItem = myPathItem.subPathItems[j];
- f.writeln(myPathItem.name + ', subpath ' + j);
- var nrPoints = mySubPathItem.pathPoints.length;
- for (k=0;k<nrPoints;k++) {
- var myPoint = mySubPathItem.pathPoints[k];
- var myAnchor = String(myPoint.anchor);
- var coords = myAnchor.split(',');
- f.write(Math.round(coords[0]) + ',' + Math.round(coords[1]));
- if (k+1!=nrPoints) f.write(',');
- }
- f.writeln();
- }
- }
- f.close('w');
- app.preferences.rulerUnits = origUnits;
- //alert('Coordinates writen to file ' + filePath);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement