How to use Symbol Options within a Script

Contributor ,
Dec 20, 2021 Dec 20, 2021

Copy link to clipboard

Copied

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,

BryanPagenkopf_1-1640018507030.png

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

 

Thank you!

TOPICS
Scripting

Views

55

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 20, 2021 Dec 20, 2021

Copy link to clipboard

Copied

LATEST

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();

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines