7 Replies Latest reply on Jun 1, 2015 8:46 PM by philosoraptor

    Can this be done (preferably without scripting)?


      It would be really nice, though not essential, for a current project of mine, if I could automate the following:

      • Wherever there are two or more consecutive paragraphs in paragraph style X, for each of those paragraphs other than the first, if some other conditions are met, change that paragraph to paragraph style Y.

      The "other conditions" could be specified a couple of different ways. Containing or not containing a certain character (specifically a colon) would work, or having either all or none of that paragraph's text in a certain character style. (Both should be equivalent if everything is formatted the way it's supposed to be, and would amount to "this paragraph doesn't contain a certain sort of inline heading".)


      Can this be done, and if so, what is the easiest way to do so for a more or less entry-level Indesign user?

        • 1. Re: Can this be done (preferably without scripting)?
          Michael Witherell Adobe Community Professional

          You might benefit by reading about Nested Styles and also GREP styles. Both of these are deeper tricks within a paragraph style.

          • 2. Re: Can this be done (preferably without scripting)?
            philosoraptor Level 1

            I'm well aware of nested styles. That's how I'm doing the inline headings I mentioned. I don't see how that helps me directly with this question, though. I'll look into GREP a bit more.


            In case there was a misunderstanding, I don't need help with creating the styles in the first place, I need help with automating the process of applying them. I don't know about GREP (will self-educate on that point this afternoon), but nested styles are an answer to the first question, not the second one.


            For context, this is a fairly large, already-written document imported from a program that doesn't allow much formatting (MS Access). I've managed to automate applying most of the styles I need but there's a few places that gives an unwanted or at least suboptimal result. I'm resigned to fixing some of them by hand, but one aspect of this - the one described above - looks like it could in principle be done programmatically. I just don't know how to pull it off.

            • 3. Re: Can this be done (preferably without scripting)?
              philosoraptor Level 1

              GREP styles, like nested styles, seem to be an answer to the wrong question, unless I'm misunderstanding something (in which case I would appreciate a pointer at what I might be missing). For one thing, they only seem to be able to apply character styles, and only based on the text in the relevant paragraph. I need to apply a paragraph style, based in part on its relationship to other paragraphs. GREP does seem like it will be handy for certain other things I want to do, so thanks for that, but it doesn't address the specific thing I asked about here. Again, the question is not about creating a style, but about automating the process of applying it.


              So I ask once again, is there a way to automate the process of going through a document and applying a paragraph style (which already exists, I don't need help creating it!) to paragraphs that meet certain criteria, where those criteria include things like "there are two or more consecutive paragraphs in the same style" which can't be straightforwardly expressed in the Find/Change box? (Or if they can, I haven't figured out how.)


              It seems like something that could be done programmatically. I suspect it requires scripting but I'd love to be pleasantly surprised on that point.

              • 4. Re: Can this be done (preferably without scripting)?
                Obi-wan Kenobi Level 5

                Hi, Screenshots please!  ;-)

                • 7. Re: Can this be done (preferably without scripting)?
                  philosoraptor Level 1

                  @Eugene: I assume you mean the trick he shows around the 5 minute mark (I was already familiar with the stuff he covered before that). Once again, that looks like a cool thing I'll definitely be using, but not for this specific situation.


                  That would work great if there were a consistent, content-independant pattern to which styles I'd want in what order. For example (let's once again call the two relevant styles X and Y), if I consistently wanted to alternate, XYXYXY, that would do the trick. Unfortunately, while there are times when this is the case, the situation I'm asking about isn't one of them. When the current document has, say, four consecutive paragraphs in style X, I might want to change that to XYXY in one case, XYYY in another, and XYYX in a third. It depends on what's actually in those paragraphs.


                  @Frans: That looks interesting too, but I am not looking to add (and learn!) a for-pay plugin at this time.


                  @everyone: I think I'm going to go ahead and just do this by hand. In fact, I'm already about a quarter of the way through doing so (along with other styling that required human judgment and so obviously couldn't be automated), and it's not as tedious or time-consuming as I'd feared. The time I've spent here and elsewhere trying to figure out how to automate this is at least a significant fraction of the time it would have taken to just go ahead and do the whole thing manually! There may in theory be a more efficient way to do this, but so far my efforts to find that more efficient way have not themselves been efficient.


                  Thanks anyway, though - I learned a lot from this thread even though none of it directly solved the immediate problem.