1 Reply Latest reply on Jan 12, 2018 5:58 AM by Kasyan Servetsky

    Change the Document dictionary preferences

    selvam214 Level 1

      Hi All,

      I'm trying to change the Document dictionary preferences as below, but I can't change effectively. Can you please guide on this.

       

       

      What I need:

      Screen Shot 2018-01-12 at 6.06.51 pm.png

       

      Particularly to these area (Language and path, Hyphenation and Spelling):

      Screen Shot 2018-01-12 at 6.11.38 pm.png

       

      Only I have achieved unwanted root (report method in "Proxmity" in below):

       

       

       

      main(); 

      function main(){ 

          var myDocument = app.activeDocument, 

          mLang = myDocument.languages.everyItem().getElements(), 

          cLang, temp1, temp2, 

          msgString = "";

          while ( cLang = mLang.pop() ) { 

              temp1 = cLang.spellingVendor; temp2 = cLang.hyphenationVendor; 

              if (temp1 == "Hunspell" || temp2 == "Hunspell"){msgString += "Spelling: " + temp1 + "\rHyphenation: " + temp2 + "\r";}

              } 

          if(msgString.length){if(String(msgString).match(/Hunspell/i)){alert("Preference --> Dictionary --> Hyphenation: \r"+msgString+"\r\rPlease correct and run it again!");exit(0)}}; 

      }

       

       

      //Basic setting change based on the UK

      var myDoc = app.activeDocument;

      myDoc.textDefaults.appliedLanguage = "English: UK";

      myDoc.dictionaryPreferences.mergeUserDictionary=true;

      myDoc.dictionaryPreferences.composition=ComposeUsing.USE_USER_DICTIONARY;

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

      app.menuActions.item("Dictionary...").invoke();

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;

      myDoc.save();

       

       

       

       

      Thanks,

      Selva