12 Replies Latest reply on Dec 17, 2015 8:05 AM by gert verrept

    1er and 1re

    gert verrept Level 2

      A script was made for putting "er" and "re" in superscript in french texts. Unfortunately it doesn't work for "re".

       

      //DESCRIPTION: change 1er en 1ere

      //

      app.findTextPreferences = NothingEnum.nothing;

      app.changeTextPreferences = NothingEnum.nothing;

       

      app.findTextPreferences.findWhat = "1ère";

      app.changeTextPreferences.changeTo = "1re";

       

      test = app.activeDocument.changeText();

       

      app.findTextPreferences = NothingEnum.nothing;

      app.changeTextPreferences = NothingEnum.nothing;

       

      doc = app.activeDocument;

       

      var aantal = test.length;

       

      for (i=0; i<aantal; i++) {

       

        doc.select(test[i]);

        doc.selection[0].contents = "1";

        locatie = doc.selection[0].insertionPoints;

        document.select(locatie[1]);

        document.selection[0].contents = "re";

        locatie2 = doc.selection[0].insertionPoints;

       

        document.select(locatie[1]);

        tekst = document.select(locatie2,SelectionOptions.addTo);

        document.selection[0].position = Position.superscript;

       

      }

       

      app.findTextPreferences = NothingEnum.nothing;

      app.changeTextPreferences = NothingEnum.nothing;

       

      app.findTextPreferences.findWhat = "1er";

      app.changeTextPreferences.changeTo = "1er";

       

      test = app.activeDocument.changeText();

       

      //app.findTextPreferences = NothingEnum.nothing;

      //app.changeTextPreferences = NothingEnum.nothing;

       

      doc = app.activeDocument;

       

      var aantal = test.length;

       

      for (i=0; i<aantal; i++) {

       

        doc.select(test[i]);

        doc.selection[0].contents = "1";

        locatie = doc.selection[0].insertionPoints;

        document.select(locatie[1]);

        document.selection[0].contents = "er";

        locatie2 = doc.selection[0].insertionPoints;

       

        document.select(locatie[1]);

        tekst = document.select(locatie2,SelectionOptions.addTo);

        document.selection[0].position = Position.superscript;

       

      }

      could someone take a look at it pls.