2 Replies Latest reply on Jan 1, 2014 7:49 AM by Jump_Over

    H&J set up properly but still causing an error


      I've seen questions related to scripting  "Hyphenation & Justification" and have already: 1) checked to see that all settings fall within range ...and, 2) listed the order of the scripting, to setting them in order (Maximum / Desired / Minimum) to avoid any errors that would even happen in the native H&J dialog for Indesign. Although it happens to be soooo random that this script still encounters a "Data is out of range" error. I did insert a "while loop" prior to the H&J section, and it would run over a few times in ETSK and somehow resolve the errors (yet, I'm w/o the knowledge on how to stop it if it's ran from the script panel).


      It is likely occurring as it would in the native dialog box; that it's trying to set a property that is greater than what is currently set for the text.


      Any thoughts on how to loop and suppress the errors, overwrite, or better access the selected text to modify these properties? Thanks so much for any help!


      if(app.selection.length != 0){

          var myTexts = app.selection[0];

          switch (myTexts.constructor.name){

              case "TextFrame":

              var myTexts = app.selection[0].texts[0]; break;

              case "InsertionPoint":

              var myTexts = app.selection[0].paragraphs[0]; break;

              default: var myTexts = app.selection[0];




              myTexts = app.activeDocument.stories.everyItem().texts[0];



          with (myTexts)


      hyphenation = false;

      composer = "Adobe Single-line Composer";

      noBreak = true;

      kerningMethod = "Optical";



      maximumWordSpacing = 60;

      desiredWordSpacing = 55;

      minimumWordSpacing = 50;

      maximumLetterSpacing = 200;

      desiredLetterSpacing = 20;

      minimumLetterSpacing = 15;

      maximumGlyphScaling = 200;

      desiredGlyphScaling = 180;

      minimumGlyphScaling = 50;



      tracking = 0;

      horizontalScale = 100;