Thanks, that works pretty well. Only problem is that it doesn't copy the last segment. The script I finally came up with (and I didn't check back here until I was done) is:
(Questions at the bottom)
[code]
//Grabs the selected paths from the current page.
var mySelection = app.activeDocument.selection;
//Starts a loop to iterate for every selected path
for (i=0; i<mySelection.length; i++)
{
//Starts a loop to iterate for every point in a given path
for (j=0; j<mySelection[i].pathPoints.length; j++)
{
//Create a new path, mySegment, and put a new set of points in it, myPoints
var mySegment = activeDocument.pathItems.add();
var myPoint1 = mySegment.pathPoints.add();
var myPoint2 = mySegment.pathPoints.add();
//Stroke the path so I can see the results
mySegment.stroke = true;
//Set all of the first point's attributes to the original copy's
myPoint1.anchor = mySelection[i].pathPoints[j].anchor;
myPoint1.leftDirection = mySelection[i].pathPoints[j].leftDirection;
myPoint1.rightDirection = mySelection[i].pathPoints[j].rightDirection;
myPoint1.pointType = mySelection[i].pathPoints[j].pointType
/*
Set all of the second's. If it's copying the last point on the path,
the next point is the first. This creates an extra segment when dealing
with un-closed paths; delete it by hand.
*/
if (j==mySelection[i].pathPoints.length - 1)
{
myPoint2.anchor = mySelection[i].pathPoints[0].anchor;
myPoint2.leftDirection = mySelection[i].pathPoints[0].leftDirection;
myPoint2.rightDirection = mySelection[i].pathPoints[0].rightDirection;
myPoint2.pointType = mySelection[i].pathPoints[0].pointType
}
else
{
myPoint2.anchor = mySelection[i].pathPoints[j+1].anchor;
myPoint2.leftDirection = mySelection[i].pathPoints[j+1].leftDirection;
myPoint2.rightDirection = mySelection[i].pathPoints[j+1].rightDirection;
myPoint2.pointType = mySelection[i].pathPoints[j+1].pointType
}
}
}[/code]
I'm using the CS2 version, what should I make different about the above so that I can use it as a Scriptographer script? And how do I make a code block on this forum?