Skip to main content
Inspiring
December 20, 2021
Question

How to use Symbol Options within a Script

  • December 20, 2021
  • 1 reply
  • 249 views

Good Morning,

 

I have a script that places a Symbol, but it recognizes it only as the "Number" of the Symbol.  ie if it is the 6th Symbol in my library of Symbols that I want to pull I set up my var as 

var symbolNum = 6;

 

Is there a way I can reference that symbol by the Name in the Symbol Options,

so that if I change the order of my symbols it still pulls the correct symbol?

 

Thank you!

This topic has been closed for replies.

1 reply

Silly-V
Legend
December 20, 2021

You can get the symbol by name like other items in Illustrator, with the 'getByName' method:

#target illustrator
function test(){
	var doc = app.activeDocument;
	var s = doc.symbols.getByName("DateField_over");
	alert(s.name);
};
test();