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

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

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

Similar Messages

  • Script to duplicate Basic Paragraph style, then change character point size

    I'm looking to create a script that will create a cascade of paragraph styles based on the [Basic Paragraph] style settings. My goal is for each new paragraph style's character point size to be a percentage of the original [Basic Paragraph]'s. So if [Basic Paragraph] is 100% (character point size 10pt), the script would create a paragraph style named '120%' that has a character point size of 12pt. Then 133%, 140%, so on and on. I modified a script found on this forum to generate those new styles, but I don't know how to create them to be basedOn the [Basic Paragraph]. Any help would be very much appreciated, thanks in advance.
    current script:
    var doc = app.activeDocument,  
        pstyle = ["100%", "120%", "133%" ];  
    for(var i =0;i<pstyle.length;i++)  
            if(pstyle[i] == "100%") 
                doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10});              
            else if(pstyle[i] == "120%") 
                doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10*1.2})              
            else if(pstyle[i] == "133%") 
                doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10*1.33333})              

    Try this,
    var doc = app.activeDocument, 
        pstyle = ["100%", "120%", "133%" ]; 
    for(var i =0;i<pstyle.length;i++) 
            if(pstyle[i] == "100%")
                doc.paragraphStyles.add({name:pstyle[i], basedOn: doc.paragraphStyles[1], appliedFont:"Minion Pro", pointSize:10});             
            else if(pstyle[i] == "120%")
                doc.paragraphStyles.add({name:pstyle[i], basedOn: doc.paragraphStyles[1], appliedFont:"Minion Pro", pointSize:10*12})             
            else if(pstyle[i] == "133%")
                doc.paragraphStyles.add({name:pstyle[i], basedOn: doc.paragraphStyles[1], appliedFont:"Minion Pro", pointSize:10*1.33333})             
    Vandy

  • Syntax to only allow certain values in column

    What is the syntax, when I create a table, to only allow certain values in a specific column ?
    create table x
    col1 char(1) <- for example, only want to allow Y or N
    ) tablespace myspace;

    That would be a check constraint. Please check the oracle syntax on constraints.
    create table x
    col1 char(1),
    CONSTRAINT check_col1
    CHECK ( col1 in ('Y','N') )
    ) tablespace myspace;

  • Change paragraph style from X to Y in Pages Doc

    Hi
    Sorry for such a simple question, but I have looked through the Applescript manual and searched this forum and can't find a solution to my problem.
    All I want to do is loop through the paragraphs of a Pages document and if the paragraph style is "Body Full", then change it to "Body Half". I have tried if statements repeat statements and everything I can think of but can't seem to get it to work. I can loop through all the paragraphs and change them to "Body Half", but as soon as I try to select only those whose paragraph style = "Body Full" it doesn't change any.
    Here is an example of my attempt:
    tell front document of application "Pages"
    repeat with X from 1 to count (get paragraphs)
    if paragraph style of paragraph X = "Body Full" then
    set paragraph style of paragraph X to "Body Half"
    end if
    end repeat
    end tell
    If anyone could help I would be grateful. It's kind of embarrassing since I was a programmer for many years on mainframes and AS/400. Scripting is a new world to me.
    Thanks in advance.
    Jim

    Hello
    Jim Kahler wrote:
    I am also using iWorks 09. Now the indent level sets all paragraphs to the indent level of wherever the insertion point was when I ran the script.
    ? Still confused, it looks so easy!
    Jim
    Ok, i understand.
    Here is the solution :
    tell front document of application "Pages"
    set sel to selection
    set search_style to paragraph style "Body Full"
    set new_style to paragraph style "Body Half"
    repeat with X from 1 to count paragraphs
    tell paragraph X to if its paragraph style = search_style then
    select character 1
    set Y to indent level
    set its paragraph style to new_style
    set indent level to Y
    end if
    end repeat
    select sel
    end tell

  • Exporting text only from specific paragraph style

    Hi,
    Is there a way to export text from Indesign to txt or preferably Excel from specific paragraph style ? I am trying to export only item numbers and prices to excel spread sheet so I can compare against original excel spreadsheet.
    Thank you !

    Not built in, no. But you could do this:
    Create a new paragraph style called "Delete Me". In the paragraph styles
    palette, select all the paragraph styles you're NOT interested in.
    Delete them in one go, and replace them with "Delete Me."
    Now, in the find/replace box, search for "Delete Me" and replace with
    nothing. This will cause all the paragraphs that have the "Delete Me"
    style to be deleted.
    Now what remains in your document is only the text that you're
    interested in.
    Ariel

  • Grep script that looks for paragraph style A followed by paragraph style B

    Hello,
    I am fairly new to scripting in Indesign and I have run across something I want to script that I don't know how to do. Two of the paragraph styles that are in our files are Normal and Song. I need to add an extra paragraph return between all instances of Normal followed by a Song. I tried to search the forums to see if this was already on here somewhere and if it is I didn't come across it. I would like to set it up as a grep script but if anyone has an alternative way to do this I would like to know also.
    Thanks in advance

    Hi,
    So you could use a script.
    I assume a text frame with proper story is selected and whole story is in one frame or linked frames.
    myStory = app.selection[0].parentStory;
    if (myStory.constructor.name !== "Story")
         alert ("Select a destination text frame, pls\rand try again");
         exit();
    myNormal = app.activeDocument.paragraphStyles.item("Normal");
    mySong = app.activeDocument.paragraphStyles.item("Song");
    app.findTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = mySong;
    mFound = myStory.findText();
    len = mFound.length - 1;
    if (len >= 0)
         while (len--)
         currPara = mFound[len].paragraphs[0];
              if (myStory.paragraphs.previousItem(currPara).appliedParagraphStyle == myNormal)
              currPara.insertionPoints[0].contents = "\r";
    rgds

  • How do I only allow certain users to print in color?

    Product Name: HP Color LaserJet Professional CP5225dn Printer (CE712A)
    Operating System Installed: Windows 7 Enterprise (64bit)
    I work at a K-12 school and purchased the HP Color LaserJet Professional CP5225dn Printer (CE712A) for use in our computer lab. I would like to know if it is possible to have it so that only certain users can print in color (possibly put a password on it). I know the cost for color is higher, and therefore, would like it so that students have to approve through teacher if they want to print in color.
    We are running it on our Print Server (networked) not through USB.
    Thank you for the help.

    Hi,
    That's a very good question actually. In my corporate networks, we are talking about hundreds of laser printers and the ONLY thing we can do: only allow people access to a set of mono laser printers, not all printers. For example, the following printer is using B&W as default but can't stop users to print in colors if they could access to the resourse:
    Regards. 
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • I want to set up Firefox to only allow certain pages to load - how do I do this?

    My children are having my old laptop and I dont want them to be able to 'stumble' across anything unsuitable.
    How can I set up Firefox so that it only allows pages to load from websites I choose?
    Thanx!

    See:
    * https://support.mozilla.com/kb/Parental+controls
    * http://kb.mozillazine.org/Parental_controls

  • Blocking p2p or setting up a firewall to only allow certain programs?

    Hello there,
    I have a wireless dual-n router (WRT610N) and a cable modem (CM100) both from linksys.
    My problem is that we live in an aprtment with 6 people and sometimes the connection crawls even with 2-3 people using the internet. My concern is that my roommates are file sharing like hell sometimes and eating all the bandwith. We're talking 20second to load the google main page slow, no person should be making the network that slow when it's just me and them using it.
    So I'm interested in options to block access to bandwith killing activities. Friends have recommended that I set up a firewall and only permit certain programs access but I have no idea how to go about doing this. Another option would be if their was just a way to limit their bandwith, I already have my computer set with the highest prioriety on the network and it doesn't help.
    Please let me know of any solutions you can suggest for this problem it sucks to be dishing out extra for highspeed internet + powerboost just to have all of fizzle away the second the connection hits the router.  

    You cannot limit their computer's bandwidth, however if you know what time they are using the bandwidth and downloading from Internet you may block the Internet access for them using the Access Restrictions, you can enter their MAC Addresses and schedule a time when you want to Deny Internet Access for them...

  • Only allowing certain photos to be sent in SMS

    Hello,
    I have only had my Xperia Z3 Compact for a few days, but I have taken several photos on it. When I try and send a photo through a text message it only shows certain ones which will send. Any other photo I choose pops up with "photo could not be added". Why does it do this and how can I fix it to send all of my photos?

    Try this
    settings > apps > all > album/messaging > clear data > restart the phone and check again 
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • Unable to setup pop3 email on new ipad, it only allows an imap4 account, this has now stopped pop 3 sending and receiving on iphone 4s, what do i do?

    it only allows an imap4 account, this has now stopped pop 3 sending and receiving on iphone 4s, what do i do?

    its a personal ipad, its my wifes actually.. bought it last week. i have managed to finally add it as a pop server... wasnt giving the option to choose imap or pop just automatically ? Emails now seem to be incoming again however the issue is sending an email.... all settings are correct for a blueyonder email account, it shows in sent items but not received at the recipients end..
    I know its an issue with the SMTP settings on the ipad and iphone as sending it from online mail works fine... very strange? any advice

  • Which paragraph style options break TOC generation?

    Hi,
    I've had a problem with generating tables of contents in InDesign CS3 and which persists in InDesign CS4.
    After much experimenting I've learned that there's something in the paragraph style settings for the headings I want to include in a TOC that prevent them being included. The generated TOC in CS4 is empty. In CS3 it contains two empty paragraphs.
    When I try to create a TOC on the same text, but no style applied to the headings it works.
    So can anyone advise if there's any paragraph style settings (e.g. to do with line and page breaking) that will prevent that paragraph appearing in a TOC?
    Any advice much appreciated!
    Thanks,
    Stu

    Hi,
    Correction to my previous message: I was wrong about the TOC generation working for unformatted headings, it doesn't work then either.
    Would some InDesign expert out there be willing to receive a cut-down version of this document to see if they can successfully create a TOC for it? That's probably the easiest way to learn what I'm doing wrong.
    Thanks,
    Stu

  • InDesign keeps freezing when updating a paragraph style, a color swatch or moving pages

    I am experiencing a very serious blocking bug. Somehow, when I update certain text styles and click Preview or Update Style Definition, the program goes to 100% CPU (single thread) and never recovers. The same happens when moving certain spreads in the document or updating a color swatch. I suspect a bad font, but I can't change the fonts, because the program freezes when I redefine styles. When I change the color or font manually in the workspace of the document, everything works. Any ideas, Adobe?
    I have tried deleting the SavedData and Preferences, it doesn't have an effect.
    I am using InDesign CC 2014 on Windows 7. I have never experienced such behavior from InDesign before. (I've got a lot of experience with the program since Version CS1)

    I've done what you said. All fonts used are deleted. The problem is persisting. The fonts are from good sources, so I wouldn't expect that. This is specific to InDesign CC2014.

  • I cannot get my new Ipod Nano to pair with my bluetooth Headphones. It just searches endlessly.  These same headphones work with my blackberry playbook.  Does Apple only allow certain bluetooth devices to pair?  i.e. only the ones sold on their site?

    I cannot get my new Ipod Nano to pair with my bluetooth Headphones.  It searches without finding it. This headset works fine with my blackberry playbook.  Any suggestions? 

    thanks for reply... I saw on the Nano package that it is only compatible with bluetooth 4v.  Is that the same as A2DP.
    That's probably the problem... it wasn't a high-end headset. 

  • Can spell check run only within a certain paragraph style?

    Hello fellow designers.
    I am using InDesign CS3. I have quite a large Exhibitor Directory list for a conference guide and need to run spell check on it. I would however like to just run the spell check on the company description portion and not on all the international addresses and company names. Is this possible? Is there a third-party plugin to assist in this task?
    I appreciate all your help and advice in advance.
    Thank you kindly.
    --Dimitry

    Here's what you can do. Though it my not be quicker...
    Do a search for the paragraph format (It will select all your text)
    Check spelling with search set to selection.
    On CS$ both panels stay open making it pretty easy to check back and forth. Not perfect, but perhaps a bit faster than a general search.

Maybe you are looking for

  • Epson Stylus Photo R320 Won't show in OS 9.2.2 Chooser

    I just purchased an Epson Stylus Photo R320, primarily to print on CDs and DVDs. This fancy new inkjet replaced my dependable Epson C-86. My problem is that after installing the Epson printing software on my G5 2.0, I can print, as usual, great in 10

  • 10.5.2 and Windows 2003 Domain and Home Folders

    Hello, This has probably been beaten to death but cant seem to find the answer that I'm looking for. I can add the mac to the 2003 domain fine with no problems and can get the user authentication fine, access to the network shares and printers. The q

  • Recording from internet results in echo

    I tried to record a song from last.fm and youtube. While recording there is an echo sound and/or a delay in the tracks. I've posted this as a bug in Papago. This sound delay does not occur when I use AVS Media to record. This is a major problem

  • Write array to file

        Hi, i am trying to write an array coming out of a for loop into a file. If i plot the array in the Front panel everything works, but if i write it to a text file some aditional characters (empty space and this rectangle) appear. The file should l

  • Calculated key figures with incorrect values

    Hi experts, i have a requirement whre i have multiple calculated key figures based on different restricted key figures. say for eg: RKF1-restricted to calmonth 01.2006 RKF2-restricted to calmoth 01.2007 ckf1-RKF1 %a RKF2 RKF3-restricted to calmonth 0