簡體   English   中英

InDesign:刪除文檔字典

[英]InDesign: Delete Document Dictionary

我在InDesign CS 5.5中刪除文檔詞典時遇到問題。

InDesign文件字典

我可以使用以下腳本清除用戶詞典的內容:

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);
}

但這使文檔字典保持不變。 幾年前,這是一個尚未解決的問題,在Adobe論壇上可以看到。

但是我發現了這段代碼( 從這里開始 ):

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

好像能夠訪問文檔字典。 但是我的問題是(由於我不是一名程序員,所以),如何修改此代碼以清除或刪除文檔字典(對於英語:美國)?

實際上,事實證明這比我預期的要簡單。

這是將刪除/清除文檔詞典的腳本:

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);
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM