Answered
Illustrator script embed selected art in selected layer
Hi there,
I have an Illustrator document with multiple layers and multiple layers with linked images/art in them. I would like to with a script select a specific layer and embed all images in the selecte layer only.
This is the script I have but as soon as I have multiple images in the layer it will only embed one of the images.
var i = 1
var doc = app.activeDocument;
var myLayers = doc.layers;
EmbedTestLayer();
function EmbedTestLayer()
{
//Layers visible and unlocked
for (a=0; a<myLayers.length; a++){
myLayer = myLayers[a];
myLayer.visible = true;
myLayer.locked = false;
}
}
try{
//Deselect all objects
app.activeDocument.selection = null;
//Embed objects in layer
myLayers.getByName ("Test Layer").hasSelectedArtwork = true;
placedArt = app.activeDocument.placedItems[i];
placedArt.embed("Test Layer");
}
catch (e) {}
Test Layer is the layer that I want to select as well as all elements/sublayers and then embed the Art.
Help will be greately appreciated.
