6 Replies Latest reply on Jan 2, 2012 5:25 PM by rafikibubu

    (new to scripting) Only allow certain paragraph styles to break to next column/page

    rafikibubu Level 1

      Hi all,

       

      As stated, I'm very new to scripting. I've done a few small scripts to automate Photoshop tasks and such. I'm in the process of trying to learn Javascript as much as possible, with the hope of bringing about more efficiency for our small production department. It's a daunting task, but I'm trying my darnedest.

       

      One of the number one goals I have is the find a way to automate pagination of weekly transaction records. These records run between 32 to 48 pages normally, with each page having 5 columns. Creation of these pages is very systematic, so it would seem that this process should be able to be automated, but there are some challenges I'm having a hard time thinking about how to attack.

       

      One of the key tasks needing to be figured out is getting the records to go in with headings and subheadings always starting at the top of a page/column. Just about all the copy comes in with predetermined paragraph styles, so a script should easily be able to search for instances of each style. What needs to eb accomplished is only allowing the flow of copy to break on certain styles and not others ... (counties, towns, etc.)

       

      For example: if you have the following  ...

      ----------------------

       

      Countyland <styled "county">

      Utopiatown <styled "town">

       

      46 Appletree Lane ...... $500,000  <styled "listing">

      Sold by: Some Guy   <styled "listing">

      Bought by: Other Guy  <styled "listing">

      Mortgage: This Bank  <styled "listing">

      Date: 12/14/11  <styled "listing">

       

      Dystopia Village <styled "town">

       

      47 Orangeplant Road ...... $400,000  <styled "listing">

      Sold by: Some Guy   <styled "listing">

      Bought by: Other Guy  <styled "listing">

      Mortgage: This Bank  <styled "listing">

      Date: 12/14/11  <styled "listing">

       

      ----------------------

       

      If the two records above were to fall near the end of a column, the break to the next column should NOT occur anywhere except:

       

      - Before the county (causing the county to start at the top of the next column

      - Before the second town (Dystopia Village, forcing that town to the top of the next column)

      - After both (forcing whatever town/county is next to goto the top of the next column)

       

      So basically, I need to find a way PREVENT column breaks where they should not occur. Inserting column breaks is one thing (I know how to do that). Prevention is the issue though that confounds me.

       

      Does anyone have any thoughts of how to achieve such a thing? I know there are "non-breaking space" characters ... is there, or could there be, some kind of a "non-breaking return" character? Or would it be more feasible to test for the paragraph style at the bottoms of columns and insert column breaks in once it finds an appropriate match?

       

      Am I going about this all wrong?

       

      Again, any help or suggestions are more than welcome.

       

      Thanks much.

      ~Nate

       

      FYI .. using InDesign cs5.5

        • 1. Re: (new to scripting) Only allow certain paragraph styles to break to next column/page
          @naomikennedy Level 1

          From what I understand from your question, I think what you might be looking for is the keep options of the paragraph styles.

           

          I would set <styled "town"> to keep with next 4 lines, and <styled "county"> to keep with next 1 line.

           

          I might also recomend  setting <styled "listing"> to keep with previous.

           

          These setting SHOULD prevent the breaks you were talking about, but this works far better with seperate text frames instead of columns.

          However, the last time I dealt with keep options and columns, they were tempramental (that was CS4).

           

          Sorry if you've already tried this. It's not a scripting solution either. You seem to be using templates, so they should be fairly easy to edit (it's pretty easy to change using a scripting solution, what language are you using?).

          1 person found this helpful
          • 2. Re: (new to scripting) Only allow certain paragraph styles to break to next column/page
            rafikibubu Level 1

            Hi Naomi, thanks so much for answering.

             

            I'm trying to use/utilize Javascript. I just assumed if I'm going to mess around with this, I'd rather not be constrained to one platform. But if ever there was an option in Applescript, that would work too, since the office uses Macs for production.

             

            And no I haven't tried that before. And that's ok it's not a scripting solution .. for now. I need to find a way to do it in Indesgn manually before I could ever hope to script it anyways.

             

            If separate text frames for each column would work better for some reason, I'm more than able to change that on the template and give it a shot.

             

            I've never used keep options before, I'm going to investigate them right now. I'm unsure though, based on your description. Do keep options only work based off of lines? Or could it "keep" until a next style? The "listings" can be any number of lines, so it's not quite as simple as my example, or not always anyway.

             

            Thanks, I'll let you know how it goes!

             

            Cheers,

            ~Nate

            • 3. Re: (new to scripting) Only allow certain paragraph styles to break to next column/page
              rafikibubu Level 1

              Hi Naomi,

               

              Yeah, it doesn't appear that will do the trick, though I feel like it could be starting down the right track. Maybe if the listing details were always a set number of lines, but such isn't the case. The number of listing lines varies for each record.

               

              Basically, records listings aren't supposed to jump to the next column or page in the middle of a listing. So headings should never be on the bottom of a column, and listing details are never at the top of a column.

               

              So if there were a way to prevent lines with the "listing" style to not break to the next column, that would accomplish the task.

               

              Thanks,

              ~Nate

              • 4. Re: (new to scripting) Only allow certain paragraph styles to break to next column/page
                rafikibubu Level 1

                I am now wondering about a possible solution. It would be one hell of a challenge for me to figure out how to code it, but I at least need to figure out the theory first, then I'll try to figure out how to code it.

                 

                Again, the issue at hand is preventing column breaks for the "listing" style in the following example. Please note, the number of "listing" lines varies. If the following two entries (in a long list of similar entries) were to be near the end of a column, I'm trying to cause the flow of text to break only before a county style, or a town style (if it's not the first town in the county).  Basically, no breaks in the middle of listings.

                 

                -----------------------------

                 

                Countyland <styled "county">

                Utopiatown <styled "town">

                 

                46 Appletree Lane ...... $500,000  <styled "listing">

                Sold by: Some Guy   <styled "listing">

                Bought by: Other Guy  <styled "listing">

                Mortgage: This Bank  <styled "listing">

                Date: 12/14/11  <styled "listing">

                 

                Dystopia Village <styled "town">

                 

                47 Orangeplant Road ...... $400,000  <styled "listing">

                Sold by: Some Guy   <styled "listing">

                Bought by: Other Guy  <styled "listing">

                Mortgage: This Bank  <styled "listing">

                Date: 12/14/11  <styled "listing">

                 

                -------------------

                 

                 

                Naomi previously suggested messing with the "keep options" in the styles. This will solve the issue of preventing breaks before listing details start. But it won't help in keeping listing details from breaking, since the number of lines can vary.

                 

                I'm now thinking ... might it be possible to have a script search all copy, looking for the last line of listings, and then apply a second listing style with a different keep option setting? The "normal listing" style would "keep next 1 line". The "last listing" style would not, therefore, allowing a break.

                 

                Here's a map of what I'm thinking: (bear with me on the terrible syntax, this is just for illustrative purposes)

                 

                listingNormal has keep with next 1 line applied

                listingBreak does not keep with next line

                 

                if currentLineStyle == listingNormal

                AND

                style of next line != listingNormal {

                 

                currentLineStyle = listingBreak

                 

                }

                 

                 

                Does this make sense? If so, does this sound feasible?

                 

                Thanks any and all.

                ~Nate

                • 5. Re: (new to scripting) Only allow certain paragraph styles to break to next column/page
                  TᴀW Adobe Community Professional & MVP

                  I can't see that you mention which version of InDesign you have. But if

                  it's CS5 or CS5.5 you've also got a "keep with previous" checkbox.

                   

                  So you could get all your "listing normal" styles to "keep with

                  previous", and the initial styles to "keep with next", and I think that

                  should do the trick.

                   

                  Ariel

                  • 6. Re: (new to scripting) Only allow certain paragraph styles to break to next column/page
                    rafikibubu Level 1

                    Hi Ariel,

                     

                    Sorry, mentioned initially but should have restated ... we are using cs5.5. But I have cs4 at home, which is what I've been testing with.

                     

                    I''m toying around with that setting now via a remote connect to the office machine ... it's a little early, but that seems like it could do the trick! THANK YOU!

                     

                    I'm going to toy around with this with some of the various records, and see if it's working consistently with all of them. Looks promising.

                     

                    Thanks again!

                    ~Nate