Swap symbol instance by changing its name?


hello all

 

i'm trying swap symbols in situ changing 'name' property of symbol instance.

 

my rudimentary script can find existing symbol name (for me, that's small triumph!). illustrator document has 2 symbols in symbols panel, 'blue_square' , 'red_circle'. run script instance of 'blue_square' (and nothing else) on page, , try change name 'red_circle':

 

var docref = activedocument;

 

var symbolitem = docref.symbolitems[0]

 

var symbolname = symbolitem.symbol.name;

 

var newname = "red_circle";

 

symbolitem.selected = true;

 

// next line causes problem:

symbolitem.symbol.name = newname;

 

this causes error - 'the name in use'. please tell me i'm mistaken?

 

many interest.

i know little javascript pertains ai .  experience in actionscript, albeit limited, try :

 

 

// next line causes problem

symbolitem.symbol.name = newname;

 

 

change to:

 

//

symbolname = newname;

 

you have declared symbolname variable above i'm thinking it's causing error.



More discussions in Illustrator Scripting


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support