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

Writing a script to change the font from "xxx1" to "xxx2" for all paragraph styles

Explorer ,
Feb 15, 2025 Feb 15, 2025

Copy link to clipboard

Copied

I am very new to scripts, and I just have a ponctual need.

I have a document using fonts no longer available.

I would like to run a script that will change the definition of all paragraphs using for example the "xxx1" font to "xxx2".

That must be pretty easy, but some help would save me a lot of time learning how to write scripts. I don't know the ExtendScript language.

Thanks.

Views

225
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

correct answers 2 Correct answers

Community Expert , Feb 16, 2025 Feb 16, 2025

If it's just one file, it might be easier to
save it as .mif,
open it in a plain text editor (Notepad will do),

examine some of the font declarations so you know what they look like,
perform a single CTLh find/change,
re-save, and
re-open in FM.

Votes

Translate
Enthusiast , Feb 17, 2025 Feb 17, 2025

Try the following:

FrameMaker menue -> View - Panel -> Fonts

 

and then: replace Fonts

Votes

Translate
Community Expert ,
Feb 16, 2025 Feb 16, 2025

Copy link to clipboard

Copied

If it's just one file, it might be easier to
save it as .mif,
open it in a plain text editor (Notepad will do),

examine some of the font declarations so you know what they look like,
perform a single CTLh find/change,
re-save, and
re-open in FM.

Votes

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
Explorer ,
Feb 16, 2025 Feb 16, 2025

Copy link to clipboard

Copied

Brillant, thanks!

Votes

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
Community Expert ,
Feb 16, 2025 Feb 16, 2025

Copy link to clipboard

Copied

Be sure to keep a copy of the pre-change file.

It would also be worthwhile to create a short document with the new font, and examine its MIF.

Font declarations in MIF can look different from the font names in the menus, e.g.
‹FPlatformName `W.Source Sans Pro Semibold.R.600'›
‹FFamily `Source Sans Pro Semibold'›

 

And what you need to change may involve more than just the name:
‹FWeight `SemiBold'›

 

For short text strings needing bulk change, there's also a minor risk of unintended changes. Fragments of font tags can appear all over the place. FM files can also contain various binary objects, presented in MIF as somewhat random-appearing blocks of hexadecimal. There is some risk that the string you are changing could semi-randomly appear in a hex object. So when changing:
‹FPlatformName `W.Source Code Pro.R.400'›
to
‹FPlatformName `W.Source Serif Pro.R.400'›
don't just change [Code] to [Serif]. Quote as much of each string as you can.

☑ Match Case

 

Plan B would be to create a small default document (template.fm).
File🞃Import…Formats
☑ Paragraph Formats only
from the active document (working.fm).
Revise just the Â¶formats of interest in template.fm

 

Then with the working.fm, and template.fm still open, you can, in working.fm
File🞃Import…Formats
of just 
☑ Paragraph Formats
from template.fm

Votes

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
Explorer ,
Feb 16, 2025 Feb 16, 2025

Copy link to clipboard

Copied

Thanks for plan B. In retrospect, less risky.

I did keep a backup just in case of the old .fm just in case, but I saved as PDF and I did a (quick) side b side comparison between the 2 PDFs, without noting anything amiss.

This and the way I posted in the other thread to eliminate the hang-ups solved all the upgrade problems.

Votes

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
Enthusiast ,
Feb 17, 2025 Feb 17, 2025

Copy link to clipboard

Copied

Try the following:

FrameMaker menue -> View - Panel -> Fonts

 

and then: replace Fonts

Votes

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
Explorer ,
Feb 18, 2025 Feb 18, 2025

Copy link to clipboard

Copied

LATEST

Very nice, thanks!.

Votes

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