Copy link to clipboard
Copied
I've got the below script, but it's not working. I'm trying to select all the art in the document on different layers, and create a symbol. So far I have the first part down, but can't figure out how to reference what is selected. actDoc.selection comes out as undefined. I've also tried to use "actDoc.PageItem.selected = true" and a few other variants, but I'm coming up empty. Anyone have recommendations for this?
actDoc = app.activeDocument
var layerCount = actDoc.layers.length;
if(layerCount > 1) {
for(i=0;i<layerCount;i++) {
actDoc.layers.hasSelectedArtwork = true // selects all layers
}
actDoc.symbols.add(actDoc.selection); // <---------- Here's where the error is thrown
}
Copy link to clipboard
Copied
if you want to make a symbol out of multiple items, group them first, the add() method takes one item as argument.
Copy link to clipboard
Copied
Thanks! That makes sense! Now I'd like to put a layer with sublayers into a symbol to maintain any effects that are on the sub layers. I have an action that runs, that does this with nested layers like this. I used to just let it group everything, but then found some effects were falling off. I tried the below, but it didn't work, and states that it's an illegal argument. Is there any way to acheive this?
layer = actDoc.layers.getByName('Editorial'); //get a reference to the newly created raster item
newsymbol = actDoc.symbols.add(layer); //add the raster item to the symbols
Copy link to clipboard
Copied
no, I don't think you can add layers, the arguments must be pageItems
Find more inspiration, events, and resources on the new Adobe Community
Explore Now