Skip to main content
Inspiring
April 22, 2024
Answered

•  Select a text by its name and change its size (in points) — Scripting

  • April 22, 2024
  • 2 replies
  • 666 views

Hello -

 

I try to make a small script to

Select a item by its name and after that

to change its size to a specific size (in points).

 

the name odf the items is "WeightSansProNormal" (as you can see in the attached screenshot)

But can't make it work 😞

 

Any help would be appreciate.

Thank you, enjoy your day.

 

 

#target illustrator

app.activeDocument.selection = null;         // Ensure there is nothing in the document selected already. This way you only get the selection you want.  

var thisDoc = app.activeDocument;
var myText = thisDoc.pageItems.getByName('WeightSansProNormal');
myText.textRange.characterAttributes.size = 16.6;

 

 

 

- Dimitri

This topic has been closed for replies.
Correct answer dimitri_cas

Hello - 

 

I dunno why,

but I turn off/on my computer and it works now  …

 

Thank sfor your feedbacks.

Enjoy your day.

 

- Dimitri

 

 

2 replies

CarlosCanto
Community Expert
Community Expert
April 22, 2024

the script should work, unless you have extra spaces in the Text Frame's name

dimitri_casAuthorCorrect answer
Inspiring
April 25, 2024

Hello - 

 

I dunno why,

but I turn off/on my computer and it works now  …

 

Thank sfor your feedbacks.

Enjoy your day.

 

- Dimitri

 

 

pixxxelschubser
Community Expert
Community Expert
April 22, 2024

Your code works for me as well without problems.

 

Do you get an error message? Or what is the problem?