Formatting the next paragraph

I am thankful that Adobe has made InDesign so thoroughly scriptable. Nothing is better than the speed and accuracy you get with a good scripting solution! And I’m grateful for the great discussion forum; usually I can find an answer to any issue here. Unfortunately I haven’t found an answer to this problem (I’m probably not looking in the right places.) Hopefully someone out there can help me.
I am working on an InDesign CS3 document and using AppleScript. I need to apply a paragraph style to 366 paragraphs. The document is structured this way:
Date paragraph (which has an already applied paragraph style called “Date”)
Title paragraph (to which I would like to apply a paragraph style called “Title”)
Body paragraphs
How can I use AppleScript to apply the paragraph style “Title” to those Title paragraphs? The only commonality they have is that, in every instance, they immediately follow a Date paragraph.
Thanks in advance!

Hi,
sorry didn't read your post as carefully as I should have ...
set toSearch to "Date"
set toSet to "Title"
tell application "Adobe InDesign CS3"
    tell active document
        set myStories to every story
        repeat with i from 1 to count of myStories
            set myStory to item i of myStories
            tell myStory
                --get indexes of pStyles whose applied Paragraph Style is toSearch
                set dateParaList to (index of every paragraph whose (name of applied paragraph style is toSearch))
                repeat with p from (count of dateParaList) to 1 by -1
                    set myIndex to (item p of dateParaList)
                    try
                        set applied paragraph style of (first paragraph whose (index is greater than myIndex)) to toSet
                    end try
                end repeat
            end tell
        end repeat
    end tell
end tell
Hope it'll work
Another approach could be to use find-change-scripting.

Similar Messages

  • IDCS3 Getting the "next paragraph style" to work

    Hi there Adobe Forum.
    If you make a paragraph style there is an option that allows you to choose which paragraph style will follow the current one. But I can't seem to get it to work. If I just select one paragraph in my document and make it have a paragraph style that has got a "next style" option in it, the next paragraph does not change.
    I tried to select all the paragraph and do the same thing, but then they all just got that paragraph style, no next.
    How do you do to make this work? It would be really smart to just select the first paragraph of a text and then choose "ingress paragraph style", which is followed by "first paragraph", which is followed by "normal text". And then be done with it.
    Any clues?

    Select them all then in right click the first paragraph style in the
    paragraph styles panel. Select apply style and next style.
    Bob

  • How do I get rid of the blank space after one paragraph and before the next paragraph startsin Pages '09?  I understand that I should not have a page break mid paragraph but that is what I want.

    How do I get rid of the blank space after one paragraph and before the next paragraph startsin Pages '09?  I understand that I should not have a page break mid paragraph but that is what I want.

    Hi stephanie,
    These are unrelated questions/statements.
    Space before and space after a paragraph are controled in the Text Inspector, as you've found out.
    Pages will create a page break whenever there is no room for another line on the page. That break can come anywhere in a paragraph.
    You may be thinking of Widow and Orphan prevention, and the other Pagination controls, found under the More button in the Text Inspector. (If that's what you found, then thanks for the refresher! I hadn't been to that pane for awhile, and had forgotten the variety of pagination controls available.
    Regards,
    Barry

  • Can I Auto format the first paragraph on every page of a 20 page document?

    So I have a document that is basically just a numbered list of 200 entries.
    There are 10 entries per page, making it a 20 page document.
    Unfortunately, every so often I am given an additional entry to add, which invariaby is to the middle of the document, and not the end.
    What I'd like to do is if I were to add a new #20 to the document, the old #20 (now #21), being pushed to the next page, would then automatically be formatted using my "StyleA" paragraph style.
    I haven't been able to discover how to do this, which means, in the above example, I need to go to 18 pages and remove the "StyleA" paragraph formatting as in each case following the addition, it is now the second entry on the page. At the same time, I have to apply the "StyleA" paragraph formatting to each first entry of all subsequent pages. If I only had to do this once in a while, it wouldn't be an issue, but as this document is updated regularily, it is getting tedious.
    Nested styles doesn't seem to be an option, since i'm using Numbering which requires a paragraph break to differentiate between each line number, and nested styles seem to apply to every paragraph, unless i'm doing something wrong there.
    I hope this is enough to go on.
    Kraeg

    You are saying that the formatting is different for every 20th paragraph, reagardless of its content, and that it is aways going to be the first paragraph on a page?
    As long as you never deviate from the 20 paragraph cycle this is actually fairly easy to do, you jsut need 20 paragraph styles, 19 of which are based on each other and differ only in the style name. You then set the "next style" attribute to rotate through the list of styles, so the next style for #20 is #1 and the sequence starts over. Now just select the entire block of text from the point where you edited to the end and right-click on the style name for the irst paragraph in the selection, then from the context menu choose Apply <stylename> And Next Style.

  • Inserting a character at the end of a paragraph IF the next paragraph is a certain style

    Hi,
    I have found a section of a collegues script that will insert a bullet at the end of a paragraph if the PREVIOUS para is styled with a certain style, I have been trying to modify it to work if the FOLLOWING paragraph is a certain style instead but as I am not sure how the "insertionPoints[f[i].index-1].appliedParagraphStyle.name" part of it is working I have hit a brick wall. Can anyone shed any light on this?
    thanks
    myDoc = app.activeDocument
    // This part checks if "News text para indent" is followed by "News title regular" and inserts a bullet
    app.findGrepPreferences = null;
    app.findGrepPreferences.appliedParagraphStyle = "News text para indent";
    app.findGrepPreferences.findWhat = "^.+$";
    f = myDoc.findGrep();
    for (i = 0; i < f.length; i++)
        var inser= f[i].insertionPoints.length
      if (f[i].parentStory.insertionPoints[f[i].index-1].appliedParagraphStyle.name == "News title regular")
    var bullet =  f[i].parentStory.insertionPoints[f[i].index+inser-1].contents="\u25CF"

    OK thanks much,
    So to do that, do i begin by highlighting the last frame (the last frame of the movie itself - actual film image) on the timeline, and go to main menu and select Insert>Timeline>Keyframe?  Then insert stop(); on the last frame via the actionscript panel?
    Then highlight the first frame and insert the setTtimeout() and  play() onto the first frame?
    I inserted the stop() command on the last frame and the clip now stops...
    I tried adding this script on the last frame and clip stops but does not repeat after 5 seconds...
    stop()
    setTimeout(5)
    play();

  • Use of "Next paragraph same page" check box in paragraph format of SCRIPT?

    Hi Guys,
    What is the use of "Next paragraph same page" check box in paragraph format of SCRIPT?
    Don't Send me the F1 help ....i am not clear with that help it is quite confusing.
    Provide example if possible.
    Solutions will be rewarded.
    Regards,
    GURU

    Hello.
    You probably know the idea of PROTECT command. It makes that a paragraph wont break in two. If it fit's totaly in one page it will print in that page. If not, it will print totaly in the second page (won't break at the middle).
    The checkbox you are asking, makes the same with two paragraphs. This means that if you have paragraphs A and B (A becomes first) and if paragraph A has that option, the next paragraph won't break, and appear in the second page. If paragraph A is in first page, paragraph B will print in first page too, or they will both print in second page.
    Try it.
    Best regards.
    Valter Oliveira.

  • Using "Next style" with the same paragraph style for more than one paragraph

    Hi.
    I have been using paragraph styles with the "next style" option, it's a huge help. But I need a bit more. So I have the following paragraph structure: ABCCCABCCCAB...
    I defined paragraph styles for each kind of paragraph, then in paragraph style A, I added paragraph style B as the next style, and so on. However, when I get to paragraph style C I reach a dilemma. Should I define the next style as the same, or define three paragraph C styles (C1, C2 and C3), link them to each other with next style, and then loop the C3 style into the A style again?
    My hope is that there is a way, something like the nested style options, that allows me to define that style C should be used for 3 paragraphs and then the next style becomes style A again.
    Thanks.

    You just need two styles, almost identical, you can duplicate one.  The only
    difference is one has the next paragraph c and one has the next paragraph
    a.  After that I don't see the problem.

  • Right-Indenting the last paragraph line in a Table Of Contents entry

    Hi,
    I'm using CS4 In Design.
    I'm trying to format the paragraph styles for my Table of Contents.
    I have the tab leaders working, everything looks good except that I have entries that have multiple lines, and I can't find a way to format the TOC paragraphs so that the lines BEFORE the last line are right-indented more than the last line (which of course contains the tab leads and page number).
    I'd like to not have to go into my text and manually add Right Index Tabs in every heading instance that will be pulled into the TOC.
    Thanks,
    Robert

    > How DOES one set last lines that don't leave room for leaders?
    One manually breaks the line short (or lives with no leaders) using a
    shift-return. I usually finesse TOCs after I think the client is mostly
    done with correcting.
    > I now note that some of my neat page numbers are nudged to the right...
    I'm not sure what that means. If you're using a right-aligned tab (or
    two tabs, if you want to right-align the ends of the leaders) your
    numbers should right-align on the tab setting. Exactly. Nothing should
    be "nudged to the right".
    Kenneth Benson
    Pegasus Type, Inc.
    www.pegtype.com

  • [CS3 AS] set paragraph style, go to next paragraph, set paragraph style, etc.

    hello,
    i'm pretty much a noob at scripting. i'd like to automate applying paragraph styles to a document with reviews.
    basically, i want to place the cursor in a paragraph (manually), and have a script do the following: set paragraph style 5, go to the next paragraph, set paragraph style 1, go to the next paragraph, set paragraph style 2, go to the next paragraph, set paragraph style 3.
    help?
    (i specified AS as i think i might understand it, but JS probably works as well)

    Assuming you set the relationship of one style to the next using the 'Next Style' definition in the paragraph styles, then the following should do the trick (assuming you have your cursor in the first paragraph).
    > // Follows next paragraph style setting until Same Style or No Paragraph Style
    >// Get the current pagaraph based on user cursor location
    var myCurrentParagraph = app.documents[0].selection[0].paragraphs[0];
    do
    ] // Currently applied paragraph style
    var myCurrentParagraphStyle = myCurrentParagraph.appliedParagraphStyle;
    ] // Next Style for current paragraph style
    var myNextParagraphStyle = myCurrentParagraph.appliedParagraphStyle.nextStyle;
    ] // Check current style and next style are not the same or No Paragraph Style
    if (myCurrentParagraphStyle == myNextParagraphStyle
    || myNextParagraphStyle == app.documents[0].paragraphStyles.item("[No Paragraph Style]") ) {
    ]] exit(); }
    ] // Get next paragraph in chain
    var myNextParagraph = myCurrentParagraph.insertionPoints[-1].paragraphs[0];
    ] // If we are end of story then stop
    if (myNextParagraph == myCurrentParagraph) { exit(); }
    ] // Apply next style to next paragraph
    myNextParagraph.appliedParagraphStyle = myNextParagraphStyle;
    ] // Restart the process
    myCurrentParagraph = myNextParagraph;
    >while (true)
    Note that the process will end when the Next Style setting of one paragraphs is Same Style or when the Next Style is No Paragraph Style. There would be other ways to end the process, such as limiting it to a certain number of steps if the number of steps was always the same. Let me know.

  • Keep a paragraph on the same page as the previous paragraph

    I know I can keep a paragraph on the same page as the next paragraph but I need to create a paragraph style that keeps a paragraph of the same page as the PREVIOUS paragraph. Is there anyway to do this?
    I used to be able to do it using my "old" M$ Windows DTP package.

    Hi Possum,
    This works. Here is a screen shot from Pages with "Show Invisibles" (the blue spaces and paragraph marks):
    Line spacing is set in Inspector to add space after each paragraph without adding blank lines (it's better that way).
    Dish Title, all descriptions, Price and the blank line below are set to "Keep with following paragraph".
    Do not include the final blank line (which is really blank) in this linking.
    Type this in Pages. Copy everything and then repeatedly Paste. See if the new pages appear as you want them.
    Regards,
    Ian.

  • GREP for next paragraph

    Hi
    I have two paragraphs, one of which is stylized by a paragraph style. Is there a way to apply another paragraph to the next paragraph?
    In Next Style, you have to type something to get the paragraph style applied. I just want that I have two paragraphs and I want both of them to have to different paragraphs style with with keyboard shortcut.
    Thanx
    Max

    Hi Max,
    I did it quickly but yes. I do it in one click using 2 regex and Multi-Find/Change ! 

  • Why does my Mac auto-select the next few words or even sentences after i select and delete a batch of text?

    For instance, if i were to select the next seven words and then over-write or delete them, the next few words would automatically become selected and, because i'm already typing, i would over-write them as well.  The more words that i initially select, the more words become selected after i hit delete.  You can imagine how annoying this might be when i decide to chuck an entire paragraph, select it, begin to over-write, and then realise that i've just over-written most of the next paragraph and part of the previous.
    This can't possibly be a feature so i don't what option i might have chosen that would've prompted this kind of behaviour from my Mac.  It's done it intermittently over the last year that i've owned it.  It usually begins after an edit or two within a given document or email.  Once it begins, it doesn't stop, it just gets worse.

    Firefox allows to select part of a word. You can select a word with a double click and use Shift + left click to set the end of the selection, so you need to click at the end of the last word instead of in it.

  • Delete specified line and next paragraph applied specified paragraph style

    Hi,
    How to find one of the specified line, then delete (e.g. <chapter>) and the next paragraph applied one of the paragraph style in the indesign javascript. Please explain

    Hi,
    Why do you want to use a [JS]? A simple grep search can do it:
    If you have to do it on other "<………>", do similar regex and use Multi-Find/Change! 
    Done with some work minutes!

  • Navigate to next paragraph while using Read out loud

    Hi all,
    I'm trying to use the new read out loud and feature. Everything works great but i do have one small question.
    I've opened a file, enabled read out loud and started read out loud. The current paragraph is surrounded by a square and read out loud. When it finishes readiing this paragraph, the read out loud stops reading. If i push the down arrow key till i get to the next paragraph it continues reading the next paragraph.
    This is really nice but i was wondering if there is some sort of keyboard combination that will move the cursor to the next paragraph without having to press the down arrow untill the cursor moves to the next paragraph?
    BBasically what i'm asking is: Is there a shortcut key for moving to the next paragraph?
    If there is no such built in keyboard, is there a way to create such a custom shortcut?
    Thanks,
    Falinn

    The Read Out Loud options are:
    Shift+Ctrl+Y — for on/off
    Shift+Ctrl+V — to read the current page
    Shift+Ctrl+B — to read to end of document
    Shift+Ctrl+C — to pause
    Shift+Ctrl+E — to stop
    Also, with the Select Tool in use, you can select text strings.
    The rectangle that bounds the select text string correlates the the container (in the structure tree of the tagged PDF) that holds the related text string on the PDF page. Often a given line will have several of the rectangles rather than one. This is related to the use of Grouping elements within the structure tree.
    No other "nav" mechanisms.
    Remember, ROL, will really rather handy, is a fairly basic text to speech feature and not full-fledged AT.
    While basic in nature ROL can be pretty serviceable (within its limitations) if the PDF is a well-formed Tagged PDF.
    To create something? Maybe, with c/c+ you could whip up a plug-in. Something a PDF developer could tell you.
    Won't bother?  AT applications already provide what you've expressed an interest in.
    Perhaps NVDA would be worth a try for a first "fitting". It is capable and free.
    If not to you liking try another AT app such as JAWS.
    Be well...

  • Go to next paragraph shortcut

    Hi,
    I might still lack some practice, since I'm a veteran of FrameMaker but a newcomer of FrameMaker Windows. So, it could not surprise if I cannot find the shortcut to "go to the next paragraph". Ctrl-down goes to the end of the current paragraph, but then stops there, until I don't press it again. On the contrary, selecting by paragraph with Ctrl-Shift-down works fine, as does moving up with Ctrl-up.
    Am I missing something?
    Paolo

    Paolo,
    You can modify the ctrl+PgDn function in the wincmds.cfg file to be the equivalent of the <esc> b p shortcut. You need to follow the instructions in the Customizing FrameMaker documentation found here: http://help.adobe.com/en_US/FrameMaker/8.0/customize_frame.pdf
    The <esc> b p sequence is defined as such:
    <Command IPToNextParaStart
        <Label Move IP To Next Paragraph>
        <KeySequence \!bp>
        <Definition \x142>>
    Modify the ctrl+PgDn function to have the same Definition.
    Do make backups of the .cfg file before you start playing with them.

Maybe you are looking for

  • How to read mp4 video

    Hello I am start working with Labview 8.20 to do a project which have to contain some videos. I already have searched in this forum some information/code examples how to play mp4 videos (or other well-know formats like avi, mpeg...), but I didn't fin

  • ME57 :scope of list

    Hi MM gurus , I have a query when i am executing the report for scope of list : I one line loop , can i get thr Release date column also ? Pl guide .

  • OS X Mavericks 10.9 crashes a lot with Logic Pro 9.1.8

    I just upgraded from Mountain Lion 10.8.5 to Mavericks 10.9 via App Store and it went fine, everything is working perfectly even Logic Pro with all the pluggins but it crashes at some points for example when i open reFX Nexus and when i reopen the sa

  • Can we create a simulated DNet device with DAQMX?

    I had no access to the Dnet interface today so I was thinking if there was a way to create simulated dnet devices on which I can run tests on. I did some searching and I found none. If you guys have any useful resources that would be really helpful.

  • Updation on XML

    Hi friends,                Is it possible to update the XML dynamically. Usually I would create an XML  statically before processing it during runtime. Actually my doubt is that can I make updation in the same XML during run runtime as doing with dat