Swap symbol instance by changing its name?
Hello all
I'm trying to swap symbols in situ by changing the 'name' property of the symbol instance.
My rudimentary script can find the existing symbol name (for me, that's a small triumph!). The Illustrator document has two symbols in the Symbols panel, 'blue_square' and 'red_circle'. I run the script with an instance of 'blue_square' (and nothing else) on the page, and try to change the name to 'red_circle':
var docRef = activeDocument;
var symbolitem = docRef.symbolItems[0]
var symbolname = symbolitem.symbol.name;
var newname = "red_circle";
symbolitem.selected = true;
// this next line causes the problem:
symbolitem.symbol.name = newname;
This causes an error - 'the name is in use'. Could someone please tell me where I'm mistaken?
Many thanks for your interest.
