Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Is there a script for changing language to multiple paragraph styles?

Return to Member Forum

  • Author
    Posts
    • #69894

      Is there a script out there that will change the language of all paragraph styles in a document? I frequently need to take US English files with multiple folders of styles and convert them for Canada English and French. Find/replace language does well enough for one-off use but I would like to clean up files as I go without going through each style one at a time.

      -Thanks!

    • #69896

      Got my answer! Thanks!

    • #69911
      Simon Clark
      Member

      Hi try the code below and check if it works

      var a = app.activeDocument.paragraphStyles;

      for (var i=a.length-1; i > 0; i–){

      a[i].appliedLanguage = app.languagesWithVendors.item(“Dutch”);

    • #70488

      Mandy hi,

      would you be so kind and share what have you done? Tnx!

    • #70650
      Gert Verrept
      Member

      I found this script once on the forum:

      var myDoc = app.activeDocument;

      var myLanguages = new Array();

      for (j=0;j<app.languagesWithVendors.length;j++){
      myLanguages.push(app.languagesWithVendors[j].name);
      }

      myDlg = new Window(‘dialog’, ‘Selecteer de taal’);
      myDlg.orientation = ‘column’;
      myDlg.alignment = ‘right’;
      //add drop-down
      myDlg.DDgroup = myDlg.add(‘group’);
      myDlg.DDgroup.orientation = ‘row’;
      myDlg.DDgroup.add(‘statictext’, undefined, “Talen”);
      myDlg.DDgroup.DD = myDlg.DDgroup.add(‘dropdownlist’, undefined, undefined, {items:myLanguages})
      myDlg.DDgroup.DD.selection = 7;
      myDlg.closeBtn = myDlg.add(‘button’, undefined, ‘OK’);

      // add button functions
      myDlg.closeBtn.onClick = function()
      { this.parent.close();
      }
      result = myDlg.show();
      alert(myDlg.DDgroup.DD.selection);

      for (i=0;i<myDoc.paragraphStyles.length;i++){
      try{
      myDoc.paragraphStyles[i].appliedLanguage = app.languagesWithVendors.item(myDlg.DDgroup.DD.selection.index);
      }catch(e){}
      }

      for (k=0;k<myDoc.characterStyles.length;k++){
      try{
      myDoc.characterStyles[k].appliedLanguage = app.languagesWithVendors.item(myDlg.DDgroup.DD.selection.index);
      }catch(e){}
      }

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
Forum Ads