How to manipulate static symbols
Hi,
background: I try to script some linting tools for a designer, for tasks such as making all "nearly black" art inside symbols a true black.
Until CC2017, a working way was
var newlayer = doc.layers.add(); newlayer.name = '_unique_name_';
var sym = obj.symbol;
var name = sym.name;
var newobj = doc.symbolItems.add(sym);
newobj.move(newlayer, ElementPlacement.PLACEATBEGINNING);
sym.remove();
// newlayer contains the artwork ready for inspection or manipulation, inside a group
newobj = newlayer.groupItems[0];
// rebuild symbol - creates a static symbol
doc.symbols.add(newobj, SymbolRegistrationPoint.SYMBOLTOPLEFTPOINT);
This no longer working in CC2018. For dynamic symbols only
newobj.breakLink();
will again make the artwork available in newlayer. If newobj is still a SymbolItem after that, it was using a static symbol.
Does anybody know how to get inside a static symbol?
