Copy link to clipboard
Copied
Hi Forum,
This is the script I m using for importing txt file in "User Dictionary" but the result is "undefined".
Could anybody help me how to import Txt file in User dictionary.
var myUserDictionaries = app.userDictionaries;
var myCountDict = myUserDictionaries.count();
var myDoc = app.activeDocument;
myAddedWords= File("//Users/wleastudio/Desktop/AVIVA_dictionary.txt");
for (var i = myCountDict-1; i >= 0; i-- ) {
myUserDictionary = myUserDictionaries;
var myAddedWords = myUserDictionary.addedWords;
myUserDictionary.addWord[myAddedWords];
}
thanks
Hi,
you may try this example for English USA:
var myUserDict = app.userDictionaries[21];//Should be English USA
var txtFile = File('~/Desktop/test.txt');
txtFile.open('r');
wordsArray = txtFile.read().replace(/["'.,:;!?()\/\d\[\]]+/g, ' ').split(/\s+/);//cleaning the text to get only "words" mostly adapted by jongware
txtFile.close();
myUserDict.addWord(wordsArray)
so long
Copy link to clipboard
Copied
Hi,
the addWord-methods expects a array of string. So you've got to open and read the txt. Then split the string to array ...
Shure you want to add those words to every userDictionary regardless of the speech they belong to?
Copy link to clipboard
Copied
Hi -hans-!
Thank you sir!...
Yes hans i need to import all the speech contains in the text file.
Because I need to detect only the spell errors recently and mistakenly happend while keying text by one.
So i'll import the total text of the document and after new text has been inserted, check for the spell errors typed recently.
Is that possible, to import the txt file, using script.
thank you sir!..
shil...
Copy link to clipboard
Copied
Hi -hans- (I want the object modules to call the "userDictionary" Import options".
I cannot find it..
How can i import TXT file through script.
thanks & regards,
Shil....
Copy link to clipboard
Copied
Hi,
you may try this example for English USA:
var myUserDict = app.userDictionaries[21];//Should be English USA
var txtFile = File('~/Desktop/test.txt');
txtFile.open('r');
wordsArray = txtFile.read().replace(/["'.,:;!?()\/\d\[\]]+/g, ' ').split(/\s+/);//cleaning the text to get only "words" mostly adapted by jongware
txtFile.close();
myUserDict.addWord(wordsArray)
so long
Copy link to clipboard
Copied
thank you -hans-..
much appreciates to you.
thanks & regards,
shil....