2 Replies Latest reply on Mar 17, 2014 7:16 AM by cchimi

    Invalid value for parameter error when value is in list of allowed parameters

    cchimi Level 2

      I have some documents with a lot of paragraph styles that have been organized into groups. I have a simple script that is meant to ungroup these styles and delete the now-empty groups.

       

      Code:

       

      #target indesign
      
      
      var myDoc = app.activeDocument;
      
      
      if (myDoc.paragraphStyleGroups.length > 0)
      {
          myDoc.paragraphStyleGroups.everyItem().paragraphStyles.everyItem().move(LocationOptions.AT_END, myDoc);
      
      
          myDoc.paragraphStyleGroups.everyItem().remove();
      }    
      
      
      alert("Done")
      
      

       

       

      The error I receive is (emphasis mine):

       

      JavaScript Error!

      Error Number: 30477

      Error String: Invalid value for parameter 'reference' of method 'move'. Expected ParagraphStyle, ParagraphStyleGroup, CharacterStyle, CharacterStyleGroup, CellStyle, CellStyleGroup, TableStyle, TableStyleGroup, Document or Application, but received Document.

       

      As you can see, my pickle is that my value is of an allowed type. This only happens in some documents, and there's nothing that obviously distinguishes those documents from the ones in which it works.

       

      One thing I've noticed is that the error sometimes takes a while to appear (a minute or so), but none of the styles have been moved once I click OK. So, I don't know if it's specific to one style. I doubt it, only because other documents with the same style set work.

       

      Can anyone shed any light on what this error could mean in this context? I definitely have an activeDocument, so what could cause a Document to not be a Document?

       

      Any help much appreciated!