Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Peter, thanks for your answer. I've post a bug request :
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 ?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more