Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Participant ,
Mar 14, 2014 Mar 14, 2014

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!

TOPICS
Scripting
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Mar 14, 2014 Mar 14, 2014

Hi,

It occurs when 2 or more styles have the same name, probably.

Jarek

Translate
Mentor ,
Mar 14, 2014 Mar 14, 2014

Hi,

It occurs when 2 or more styles have the same name, probably.

Jarek

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 17, 2014 Mar 17, 2014
LATEST

That was it, thanks. Didn't realize it was possible to have a style defined twice within a document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines