Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

change all Based On to [No Paragraph Style]

Return to Member Forum

  • Author
    Posts
    • #64314
      NMready
      Member

      Is there a script that will change all of the paragraph and character style sheets in a document to be based on [No Paragraph Style]?

      Currently, I am opening up each paragraph and character style sheet and changing the Based On: to [No Paragraph Style]. This can be a pain when there might be 50 or more style sheets.

      I am in need of doing this after the fact because I am working with customer-supplied InDesign documents.

    • #64318
      Eugenyus
      Member

      #targetengine “basedon”
      var aps = app.activeDocument.allParagraphStyles;
      var acs = app.activeDocument.allCharacterStyles;
      var len = aps.length+acs.length;
      var w = new Window(“palette”,”based on”);
      w.orientation = “row”;
      w.add(“statictext”,undefined,”styles left: “);
      var num = w.add(“statictext”,undefined,String(len));
      w.show();
      for (i=1;i<aps.length;i++){
      aps[i].basedOn = app.activeDocument.paragraphStyles[0];
      len = len – 1;
      num.text = String(len);
      }
      for (i=1;i<acs.length;i++){
      acs[i].basedOn = app.activeDocument.characterStyles[0];
      len = len – 1;
      num.text = String(len);
      }
      w.close();
      alert(“Finished”);

    • #64321
      NMready
      Member

      Thank you, unfortunately though I got an error:

      Error Number: 8

      Error String: Syntax error

      Line: 12

      Source: len = len -1;

      Offending Text: – 1

    • #64322
      Eugenyus
      Member

      Please, change the en-dash (–) to (-) two times — in 12 and 17 lines:

      len = len – 1;

      (it is somehow replaced when I made copy-paste from ESTK to the post).

    • #64356
      NMready
      Member

      Spectacular!!

      It works beautifully, thank you!

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
Forum Ads