Reply To: Script to move images to seperate layer

#112973

Hi William

You must move the parent of the graphic and not the graphic itself. The parent is the frame containing the graphic.
And then I believe you need to loop through each of them to do so. (Maybe there is a smarter way than looping.)

var theDoc = app.activeDocument;
var theGraphics = theDoc.allGraphics;

if(!theDoc.layers.item (“images”).isValid){
var imgLayer = theDoc.layers.add({name:”images”}); //adding layer if it is not present
}
else {
var imgLayer = theDoc.layers.item(“images”);
}

for (var i = 0; i < theGraphics.length; i++) {
theGraphics[i].parent.itemLayer = imgLayer;
}

This article was last modified on December 18, 2018

Comments (0)

Loading comments...