5 Replies Latest reply on Nov 17, 2014 5:55 PM by nathanwells

    Struggling to script removal of addedWords from UserDictionary

    Matthew Laun Adobe Employee

      First, I know, I work for Adobe, can I just ask some developer here? Yes, but I ask a lot from them already, and I try to give to the forum community, so I'm trying to get some in return :-)

       

      I'm trying to help a customer who has a lot of CS3 documents that have added words to dictionaries that have been embedded in the document (meaning, targeting the doc rather than the external file. These are proving problematic, and while I've got engineering looking into why that is, I'm hoping to create a script to remove the items as a workaround in the meantime. Here's the simple script I have:

       

      var myUserDictionaries = app.userDictionaries;
      var myCountDict = myUserDictionaries.count();

       

      for (var i = 1; i <= myCountDict; i++ ) {
          myUserDictionary = myUserDictionaries[i];
          var myAddedWords = myUserDictionary.addedWords;
          myUserDictionary.removeWord(myAddedWords);
      }

       

      The problem I get when I try to run this is "Object is invalid" for line 6: var myAddedWords = myUserDictionary.addedWords;

      I know I've got a valid UserDictionary and the addedWords property is supposed to return an array of strings. What am I doing wrong? And, yes, I'm a noob.

       

      Thanks for any help anyone can offer.