3 Replies Latest reply on Jan 20, 2009 2:21 PM by (Dave_Saunders)

    master pages and grep in CS3


      I'm wondering if I'm missing some nuance to handling master pages in searches. I do *not* want the master pages searched, so I set this property:

      app.findChangeGrepOptions.includeMasterPages = false;

      But I'm still getting results from the master pages.

      To be precise, sometimes I get results, and sometimes I don't. That is, I have two layouts with master pages. For one the master pages are getting searched; for the other, they aren't.

      How much nuance is there in the defining of the master pages? Could that be the problem? Or do I need to do something else in my script?

        • 1. Re: master pages and grep in CS3
          Level 1
          You've shown us one line only of your script. Are you sure that it is always executed before you do your search? Are you sure that at some other point in your script you don't switch that option back on?

          • 2. Re: master pages and grep in CS3
            Level 1
            Hi Dave,

            Thanks for your quick reply.

            Actually, I think I've figured out the problem. And it isn't exactly as I posted it...

            The script cycles through each paragraph in the active document for which nested styles are defined. It returns an alert when the search string (a nested style delimiter) is *not* found in a given paragraph. I'm getting this alert for paragraphs in the master spread.

            Essentially, since my Grep preferences say don't search master spreads, then the search operation will never find the search string in the master spread paragraphs, right? So I'll get the alert every time. Does this seem like the proper interpretation of what's going on?

            So, perhaps what I need to do is test that the current paragraph is not in a master spread before triggering the alert. Or, better yet, test at the beginning whether the parent of a given story is a master spread before I even bother to search it.

            Looking at the object model, it's not immediately clear how to do this. Can one test if the parent of a given story is a master spread? (I see from previous posts that this would likely happen via the frames and pages axes, but I'm not able to make it happen...)

            Thanks again,
            • 3. Re: master pages and grep in CS3
              Level 1
              If you use the function in this thread:


              to find the page, you can then check to see if the parent of the page is a Spread or a MasterSpread.