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

Extendscript: how to addword to indd user dictionary with case sensitive enabled ?

New Here ,
Mar 12, 2018 Mar 12, 2018

Hi, I'm working on a javascript program that needs to add non hyphenate words to the user dictionnary.

I'm able to add word to the user dictionary with something like :

   var noCesure =[ "~Crescrire"];

   var myUserDictionnaries = app.userDictionaries;

    for (var i = 0; i < myUserDictionnaries.length; i++)

    {

        if (myUserDictionnaries.name == "Français")

        {

            var mySourceUserDictionary = myUserDictionnaries;

            break

        }

    }

    if (myUserDictionnaries.name == "Français")

    {

        mySourceUserDictionary.addWord(noCesure);

    }

But it adds only "~crescrire" to the dictionary, without the uppercase C letter.

I' know it is possible to have the uppercase C in the GUI interface but I did not find how to enable the "case sensitive" switch using extendscript.

Any idea ?

Regards, Pierre

TOPICS
Scripting
484
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 ,
Mar 13, 2018 Mar 13, 2018

The user dictionary's exposure to scripting has always been rudimentary. But that words are always added in lower case must be considered a bug. Please report it here: Adobe InDesign Feedback

It's not possible to change the state of the 'case sensitive' checkbox using ExtendScript.

You could reduce your script to a single line, by the way, no need to cycle through the list of dictionaries looking for a specic one:

app.userDictionaries.item('Français').addWord ([ "~Crescrire"]);

or, to play it a bit safer,

dict = app.userDictionaries.item('Français');

if (dict.isValid) {

  dict.addWord (["~Crescrire"]);

}

P.

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
New Here ,
Mar 13, 2018 Mar 13, 2018
LATEST

Peter, thanks for your answer. I've post a bug request :

Extendscript : impossible to add word to user dictionnary with respect to upper/lower case – Adobe I...

Feel free to vote for it.

In the mean time, i've also tried the local document dictionnary. Something like :

doc.hyphenationExceptions.item("French").addException(["~Crescrire"]);

It adds the word "~Crescrire" to the local document dictionary with the upper cace C

but functionnaly speaking, it does not works because the word "Crescrire" is sometimes hyphenated. Any ides why ?

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