For Loop - No such Element
Hi,
First-time poster and new to scripting. I'm simply trying to create a step and repeat script. I have managed to duplicate my placedItem but need to move it by its own width each time it duplicates.
When I try to assign the movement to i. I receive a No such Element found. Is this due to illustrator not knowing which placedItem to move after the first one? I am confident there are better ways to do this. Any help is much appreciated.
Please see my code below.
// PlaceItem Duplicate
var docRef = app.activeDocument;
var selectArt = docRef.artboards[0];
var initItem;
var dupItems;
var transItems;
var unitMultiplier = 2.834645 // Convertsv pixels to mm.
var deltaX = 55 * unitMultiplier;
var deltaY = 0;
var length = deltaX * 4
StepRepeat()
function StepRepeat () {
for (var i = parseFloat(0); i < parseFloat(length); i+=parseFloat(deltaX)){
initItem = docRef.placedItems.duplicate(dupItems, ElementPlacement.PLACEATEND);
transItems = docRef.placedItems.translate(deltaX+i, deltaY, true, false, false, true);
}
};
