Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change font family only via a script

Community Beginner ,
Jan 06, 2025 Jan 06, 2025

Hi 

Is there a way to a launch a script to automatic change all the paragraph styles in a file from one font family to another. 

I'd like to: open a indesign file, open scripts, click a script, choose a font family i want to change to (or have one assigned), then done? 

I dont want to change the font (i.e. bold, regualr, semi, etc), i only want the family to change. I can do this manually style by style but its a long process. I found this is the default change when i try to use the find and replace formatting option in indesign. 
For example i have english files in one font (Inter) and we have translations made for me but they require to to be in (Noto Sans SC) for Chinese. 

Thanks

TOPICS
How to , Import and export , Scripting , Type
1.3K
Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025

I'm on my phone but hopefully it will work: 

 

app.activeDocument.paragraphStyles.everyItem().appliedFont = "name of your font";

 

 

It won't change Styles in subfolders - you can try and change it to allParagraphStyles. 

 

 

Translate
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
Community Beginner ,
Jan 06, 2025 Jan 06, 2025

Thanks, i have no experience writing scripts? Are you able to share a file so i can add to indesign or send an example how i can save the file locally. 

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025
Translate
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
Community Beginner ,
Jan 06, 2025 Jan 06, 2025

Thanks on the upload scripts "how to". was able to add. Bookmarked for next time. 

I receive:

Error number 25?

Error String: Expected: ;

Engine: main

File: location- shows file path

Line: 1

Source: app.activeDocument.paragraphStyles.everyItem().appliedFont = NotoSans SC;

Offending Text: Sans

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025

Should be "NotoSans SC" - inside double quotation marks. 

 

Translate
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
Community Beginner ,
Jan 06, 2025 Jan 06, 2025

Sorry.... still getting the same error 😞 

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025

Can you post a screenshot of your script - in a Notepad / text editor - with hidden characters visible? 

 

Translate
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
Community Beginner ,
Jan 06, 2025 Jan 06, 2025

martinj54220288_0-1736178362336.png

 

Translate
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
Community Beginner ,
Jan 06, 2025 Jan 06, 2025

martinj54220288_0-1736178440445.png

 

Translate
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
Community Beginner ,
Jan 06, 2025 Jan 06, 2025

i have the font installed: 

martinj54220288_0-1736178568317.png

 

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025

Last error message should be rather clear - you forgot about the space after "Noto". 

 

Translate
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
Engaged ,
Jan 06, 2025 Jan 06, 2025

Wow, Robert, I can certainly use this too. Will this change the fonts in the Paragraph Styles descriptions as well, or is that too much to hope for?

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025
quote

Wow, Robert, I can certainly use this too. Will this change the fonts in the Paragraph Styles descriptions as well, or is that too much to hope for?


By @Susan Culligan

 

What do you mean by "descriptions"?

 

Translate
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
Engaged ,
Jan 06, 2025 Jan 06, 2025

Where you set up the Paragraph Styles. Maybe I'm using the wrong term, but the "helpful boxes" (as my ex used to call them) where you set up font, spacing, etc.

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025
quote

Where you set up the Paragraph Styles. Maybe I'm using the wrong term, but the "helpful boxes" (as my ex used to call them) where you set up font, spacing, etc.


By @Susan Culligan

 

Can you post some screenshot(s) and mark a field(s) you're referring to? 

 

Translate
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
Engaged ,
Jan 06, 2025 Jan 06, 2025

I see the screenshot where you check the box "Redefine style when changing all." That's exactly whe I needed.

 

Thanks!!!

Translate
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
Community Expert ,
Jan 06, 2025 Jan 06, 2025

Wi6thout a scrip you can use the command

Type > Dind / Replace Fonts …

Activate the option to redefine styles

 

I tthink it is better than a script as you see really all used fonts.

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025

Or in Package.

 

RobertatIDTasker_0-1736207782629.png

 

Translate
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
Community Expert ,
Jan 06, 2025 Jan 06, 2025

But with package you cannot redefine styles. 

Translate
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
LEGEND ,
Jan 06, 2025 Jan 06, 2025
quote

But with package you cannot redefine styles. 


By @Willi Adelberger

 

My screenshot says otherwise? 

 

Translate
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
Valorous Hero ,
Jan 07, 2025 Jan 07, 2025
LATEST

Check out this script.

Translate
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