Issue modify symbol in a document using scripting
I need to modify a symbol in a document. Due to limitations in the DOM, I'm trying a workaround by putting it on a new layer, and trying the modify it. Then I would like to add it again as a new symbol.
But when breaking the symbol, the layer.pageItems array is empty. So I'm not able to loop the list of items.
How do i fix this?
var doc = app.activeDocument;
var tempLayer = doc.layers.add();
tempLayer.name = "TEMP";
var badSymbol = doc.symbols.getByName("BAD");
var badSymbolItem = tempLayer.symbolItems.add(badSymbol);
// Making it a regular page/layer object
badSymbolItem.breakLink();
app.redraw();
for ( var j = 0; j < tempLayer.pageItems.length; j++ ) {
// EMPTY ?
};
// Add content of a layer as new Symbol in the document
tempLayer.remove();
