Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to get default dictionary for Active document

New Here ,
Dec 07, 2012 Dec 07, 2012

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

TOPICS
Scripting
769
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 07, 2012 Dec 07, 2012

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 10, 2012 Dec 10, 2012

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 10, 2012 Dec 10, 2012
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines