3 Replies Latest reply on Dec 10, 2012 2:45 AM by [Jongware]

    How to get default dictionary for Active document

    RajGaikwad

      Hi,

       

      we want to write a script to get default Dictionary for active InDesign document.

      we are getting it by manual way that:

      Edit => Preferences => Dictionary => Language drop down

       

      but how can we do this task by using Java script.

      We tried by using Document.DictionaryPreferences but not getting the value.

      so please help me out to get the Default Dictionary language from active document

       

      a.png

        • 1. Re: How to get default dictionary for Active document
          Cenchen Level 2

          Hi,

           

               I am geeting all languages list but can't able to assign the value. Maybe its readonly property.

           

                   

          var len = app.languagesWithVendors.length;

          var arr = []

          for(var i=0;i<len;i++)

          {

              arr.push(app.languagesWithVendors.item(i).name)

          }

          arr = arr.toString().replace(/,/g,"\n");

          alert(arr)

          • 2. Re: How to get default dictionary for Active document
            Jump_Over Level 5

            Hi,

             

            myLanguages = app.languagesWithVendors // every app languages

            myLanguage = myLanguages[10]     // language with index = 10; use any you want

             

            myDoc.textDefault.appliedLanguage = myLanguage;     //this set default language for a new text in myDoc

             

            maybe not exactly what you wanted...

            • 3. Re: How to get default dictionary for Active document
              [Jongware] Most Valuable Participant

              The OP is misunderstanding the purpose of this Preference field.

               

              RajGaikwad wrote:

               

              we want to write a script to get default Dictionary for active InDesign document.

              we are getting it by manual way that:

              Edit => Preferences => Dictionary => Language drop down

               

              This is not true. This preference dialog is to set a preference for a language. The 'selected item' here has no relation at all with the "active InDesign document" (other than that the selected language may be used in the active document).

               

              So you don't get "the" default dictionary, you get "a" default dictionary -- for the very first language in the list. If your intention is to get "the" default dictionary per language in your document, you have to

               

              1st: gather a list of all used languages in your document, and

              2nd: find out the dictionary for each of them.

               

              (neither of which I have a good one-liner for).

               

              Jump_Over wrote:

              maybe not exactly what you wanted...

               

              Without further clarification from the OP, we might never know.