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

Scripting question: first paragraph on each page

Return to Member Forum

  • Author
    Posts
    • #14333962
      Pat Bensky
      Participant

      Hi,
      I’m quite new to InDesign scripting :)
      I am trying to create a script to go through each page in a document, check which stylesheet is applied to the first paragraph on the page, and maybe make changes to it if it’s a certain stylesheet.
      I am stuck on selecting the first paragraph on the page.
      Here are the bare bones of my script:
      function Main() {
      var myDocument = app.activeDocument;
      var myParStMainHeading = myDocument.paragraphStyles.itemByName(“main heading”);
      var myCharStMainHeadingTop = myDocument.characterStyles.itemByName(“hidden”);
      var myPageCount = myDocument.pages.length;
      for(var i =0;i<=myPageCount;i++){
      myPage=myDocument.pages.item(i);
      // Here I need to get the first paragraph on the page into the var “myFoundItem”
      if (myFoundItem == myParStMainHeading) {
      myFoundItem.applyCharacterStyle(myCharStMainHeadingTop, true);
      }
      }
      }

      This is the bit I need help with:
      // Here I need to get the first paragraph on the page into the var “myFoundItem”

      What’s the best way to do this?

      Thanks!
      Pat Bensky

Viewing 0 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads