1

I realize that this can be done with the find font dialogue box but I have too many files that require this text update to make that method practical.

I've tried tinkering around with GREP but I'm pretty inexperienced in it. I've gotten one font replacement set up but I can't seem to get GREP to focus on more than one font at a time.

enter image description here


Having an automatic method to do this is important because the fonts for these documents MUST match the Calibri due to special character usage and overall look.

3
  • 1
    If you have your paragraph and character styles set up properly, this can be accomplished without the need for scripts. Just update the styles in one document, then load that document's styles into the other documents.
    – 13ruce
    Commented Oct 18, 2018 at 18:27
  • 1
    @13ruce The point is that I'm not the one setting up the files. I get the files, I run this to make sure all the fonts are what they should be. Commented Oct 18, 2018 at 20:27
  • I see. This method could still be used to replace the default styles, but that probably won't be sufficient for your needs.
    – 13ruce
    Commented Oct 19, 2018 at 11:56

2 Answers 2

1

The easiest method would be to use this script:

// Replace fonts in current INDD doc according to a set list
// Each line in theFontReplacements: 'Existing Font', 'Existing Style', 'New Font', 'New Style',
// Styles are optional - leave blank ('') if unwanted

    var mydoc = app.activeDocument;

    var theFontReplacements = [
      'Minion Pro','Regular','Calibri','Regular',
      'Trade Gothic LT Std','Regular','Calibri','Regular',
      'Trade Gothic LT Std','Bold No. 2','Calibri','Bold',
      'Trade Gothic LT Std','Oblique','Calibri','Italic',
    ];

    for (i = 0; i < (theFontReplacements.length/4); i++) {

      app.findTextPreferences = NothingEnum.nothing;
      app.changeTextPreferences = NothingEnum.nothing;
      app.findTextPreferences.appliedFont = theFontReplacements[i*4];
      if (theFontReplacements[(i*4)+1] != ''){
        app.findTextPreferences.fontStyle = theFontReplacements[(i*4)+1];
      };
      app.changeTextPreferences.appliedFont  = theFontReplacements[(i*4)+2];
      if (theFontReplacements[(i*4)+3] != ''){
        app.changeTextPreferences.fontStyle  = theFontReplacements[(i*4)+3];
      };
      mydoc.changeText();

    };

The only downside is that you have to manually specify the font changes. The upside, however, is that you can specify premade conversions to be used again on recurring jobs or projects!

Installation is simple, copy the script into a Notepad editor and save it as a .jsx. Then you open the scripts panel and opposite click on User and click Reveal in Explorer.

enter image description here

Copy and paste your new .jsx file into the folder and you are all set!

0

I am looking for the same thing, which I can achieve in AppleScript but not in Javascript.

The script above works very well. However, I cannot figure out how to modify it so it also updates all empty text frames that contain a single insertion point. For example, let's assume I have a text frame that contains nothing except an insertion point set to Helvetic Mediumen, which I want to change it to Helvetica Bold. the script above does not currently change such instances.

If somebody can figure out how to add this addional functionality to the script above, that would be fantastic!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.