4 Replies Latest reply on Sep 22, 2016 8:09 AM by garymx

    Newbie question: Select a region on a master page?

    garymx

      Hello,

      I need to select and delete the footer frames on a master page (actually a two page spread) and want to learn so if someone could point me to a command or commands I can try to figure out using it. Basically a specific marquee select of the bottom eighth of the page or so--I've been searching with every term I can think of but what I've found seems to deal with something else more involved.

      Thank you

      Gary

        • 1. Re: Newbie question: Select a region on a master page?
          Skemicle Level 3

          I wrote a sample script for you to play with:

           

          doc = app.activeDocument;
          pageHeight = doc.documentPreferences.pageHeight;
          page = doc.pages[0];
          pageItems = page.pageItems;
          bottomPortion = pageHeight / 8 * 7;
          bottomItems = [];
          for(c=0;c<pageItems.length;c++){
              if(pageItems[c].geometricBounds[2] > bottomPortion){
                  bottomItems.push(pageItems[c])
              }
          }app.selection = bottomItems;
          

           

          This script will select any item that has a bottom edge that extends beyond the bottom 8th of the first page.

          1 person found this helpful
          • 2. Re: Newbie question: Select a region on a master page?
            garymx Level 1

            Cool! Thanks! I appreciate the extra info.

            • 3. Re: Newbie question: Select a region on a master page?
              Skemicle Level 3

              here is an explaination per line so you know what is going on and can modify the script to do what you need

              doc = app.activeDocument;               //set the active document to variable 'doc'
              pageHeight = doc.documentPreferences.pageHeight;               //get the current documents page height
              page = doc.pages[0];               //set page 1 of the document to variable
              pageItems = page.pageItems;               //set all page items of page 1 to an array 'pageItems'
              bottomPortion = pageHeight / 8 * 7;               //set the bottom portion of the page to select everything after this point
              bottomItems = [];               //create an empty array named 'bottomItems'
              for(c=0;c<pageItems.length;c++){               //create a loop to run as long as c is less than the number of page items
                  if(pageItems[c].geometricBounds[2] > bottomPortion){               //checks if the bottom edge of each page item is greater than bottomPortion
                      bottomItems.push(pageItems[c])               //sends the page item to the empty array 'bottomItems'
                  }
              }app.selection = bottomItems;               //selects all items in the 'bottomItems' array
              
              1 person found this helpful
              • 4. Re: Newbie question: Select a region on a master page?
                garymx Level 1

                Wow...that's great, thank you!

                I'm just dipping my toes into ID scripting after doing a few useful ones in Ventura, and Pagemaker before that. Quite a bit more involved now. The explanations will really help--I seem to learn best when I can mess with something that already works and see the effects of changes.