我在InDesign CS 5.5中删除文档字典时遇到问题。
我可以使用此脚本清除用户词典的内容:
var myUserDictionaries = app.userDictionaries;
var myCountDict = myUserDictionaries.count();
for (var i = myCountDict-1; i >= 0; i-- ) {
myUserDictionary = myUserDictionaries[i];
var myAddedWords = myUserDictionary.addedWords;
myUserDictionary.removeWord(myAddedWords);
}
但这使得文档字典不受影响。几年前,这是一个尚未解决的问题as seen on the Adobe forums.
但我找到了这段代码(from here):
var myHyphenations = app.activeDocument.hyphenationExceptions;
for (var i = 0; i < myHyphenations.length; i++) {
if (myHyphenations[i].name === "Danish") {
var mySourceDictionary = myHyphenations[i];
mySourceHyphenations = mySourceDictionary.addedExceptions;
break
}
}
这似乎能够访问文档字典。但我的问题是(因为我不是一个程序员),如何修改此代码以清除或删除文档字典(英语:USA)?
答案 0 :(得分:0)
实际上这比我预想的更简单。
这是删除/清除文档字典的脚本:
var myHyphenations = app.activeDocument.hyphenationExceptions;
var myCountDict = myHyphenations.count();
for (var i = myCountDict-1; i >= 0; i-- ) {
myHyphenation = myHyphenations[i];
var myAddedWords = myHyphenation.addedExceptions;
myHyphenation.removeException(myAddedWords);
}