Guest User

Untitled

a guest
Oct 18th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // Replace fonts in current INDD doc according to a set list
  2. // Each line in theFontReplacements: 'Existing Font', 'Existing Style', 'New Font', 'New Style',
  3. // Styles are optional - leave blank ('') if unwanted
  4.  
  5. var mydoc = app.activeDocument;
  6.  
  7. var theFontReplacements = [
  8. 'Minion Pro','Regular','Calibri','Regular',
  9. 'Trade Gothic LT Std Regular','Regular','Calibri','Regular',
  10. 'Trade Gothic LT Std',' Bold No. 2','Calibri','Bold',
  11. 'Trade Gothic LT Std','Oblique','Calibri','Italic',
  12. ];
  13.  
  14. for (i = 0; i < (theFontReplacements.length/4); i++) {
  15.  
  16. app.findTextPreferences = NothingEnum.nothing;
  17. app.changeTextPreferences = NothingEnum.nothing;
  18. app.findTextPreferences.appliedFont = theFontReplacements[i*4];
  19. if (theFontReplacements[(i*4)+1] != ''){
  20. app.findTextPreferences.fontStyle = theFontReplacements[(i*4)+1];
  21. };
  22. app.changeTextPreferences.appliedFont = theFontReplacements[(i*4)+2];
  23. if (theFontReplacements[(i*4)+3] != ''){
  24. app.changeTextPreferences.fontStyle = theFontReplacements[(i*4)+3];
  25. };
  26. mydoc.changeText();
  27.  
  28. };
Add Comment
Please, Sign In to add comment