Add style to next paragraph (by using GREP?)

Can someone help? I have a problem - long (300+ pages) text with questions and answers. Questions are using paragraph style "x" and answers are using paragraph style "y". There are usually 3-6 paragraphs of text in every answer. I need to change only the first paragraph's style after the question paragraph to style "z", so that the structure of styles would look like  x-z-y-y-y-y-x-z-y-y... (now it looks x-y-y-y-y-y-x-y-y-y...). Can it be done using GREP somehow?
Claudius

I sell a script on my website for this sort of thing:
www.freelancebookdesign.com
Under the "Scripting" tab, check out a script called "Change Consecutive
Paragraphs".
Ariel

Similar Messages

  • 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...

  • [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.

  • Change paragraph style of empty row using GREP

    Hello again ... another GREP query if anyone can assist!
    How can I change a completely empty paragraph line (like those found between verses in a poem, for example) to a different paragraph style so I can control the space better using GREP?

    Fair point ... but if I demonstrate:
    Text line here
    Text line here
    Text line here
    Text line here
    Text line here
    Text line here
    The empty row (4) between the two blocks is in the same paragraph style as the rest of the text. Indeed if lines 3 or 5 were in different styles I could remove the empty row and create a space using before/after spacing. But it is all in the same style. I was wondering if there was a way using GREP to change the para style of an empty row ie 4.

  • Use Grep Styles to add multiplication symbol.

    Hey Everyone,
    Has anyone used grep styles to change 5x6 to 5×6?  I tried to do it, but the dialog box to create a grep style is the character style dialog box. But, I am unable to enter a glyph. Now, I can use the find and search for \d+x\d+, but it will find 5x6 and change it all to × instead of changing the "x" only. I would hate to have to search for "x" in a document. Just trying to find a way to change "number 'x' number" to "number '×' number."
    Thanks,

    Or you can use (?<=\d)x(?=\d)  [that's a look-behind/lookahead withthe x in the middle] and apply a character style to scale and shift the x. GREP styles cannot change the glyph used, only the formatting.

  • 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!

  • Want to Insert Text at Beginning of a Paragraph Using GREP

    I'd like to find the beginning of a paragraph and insert a text (that uses a specific character style) into that paragraph. Below is how I've set up the find/change:
    It almost works. The phrase "SECOND ITEM IS FREE!" is inserted at the beginning of the paragraph, which is what I want. But the first letter of the word that was originally at the beginning of the paragraph picks up the character style used on the inserted text. How do I insert the text without changing the character style of the existing text?
    Thanks in advance for any ideas on this

    [Jongware] wrote:
    (Short) Can't be done.
    (Long) Well, it can, but not in a single replace. You'd have to first insert the text, then assign the correct character style.
    (Slightly longer) You are physically re-inserting that final character, and so it will get that character style assigned. The usual way of finding-but-not-marking is to use a positive lookahead; but that doesn't work, because you would end up with two locations (the caret and the lookahead), and InDesign's particular implementation of GREP does not allow that. (Or rather -- irritatingly -- sometimes it seems to work if you press the Find button, but then a Change All is not going to work.)
    So that's why you have to insert at least one character in the Find What, and re-insert it in the Replace With fields.
    If all instances of the specific paragraph style need the prefixed text in a specific character style, consider redefining the paragraph style's autonumbering to include text and character style. Redefine the style, and all instances in the current document are changed. All future uses of the style automatically use the prefixed text and style. To update existing instances of the style in other documents with the new definition, use load paragraph styles; to apply the new definition to to other documents in an InDesign book, synchronize the styles. Search Google for terms like "InDesign paragraph styles numbered lists," "InDesign load styles," and "InDesign synchronize styles in book," without quotes for details.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Sorting paragraph, apply style then next and (maybe) placing images...

    Hi everybody,
    I have to set a layout on several pages for a magazine, arranging pictures along with some text related.
    I have a text file of this kind:
    Text a/1 (should apply Heading style)
    Text b/1 (should apply Bodytext style)
    Text a/2 (should apply Heading style)
    Text b/2 (should apply Bodytext style)
    + Photo
    Text a/3 (should apply Heading style)
    Text b/3 (should apply Bodytext style)
    + Photo
    Text a/1 (should apply Heading style)
    Text b/4 (should apply Bodytext style)
    etc...
    I wish to sort the paragraphs, keep note of those where an image is needed, strip them out into a new frame on the pasteboard with the picture reference and apply to the main text column the styles in order.
    Let me explain better with some pictures...
    a) b) c)
    d) final)
    Is it possible, in your opinion?
    Thanks,
    Guido

    Okay, I created a small file with the text
    title
    subtitle
    body
    body
    body
    and the title style applied to the first line. I then ran your new 
    script, which I had to fix up a little because it got slightly messed up
    in the translation to e-mail text. And now it works!
    Let's see if I can get it into AppleScript...
    First of all, hmm, it's interesting that the script text in the forum
    has
    var style_name = "h1"
    with "h1" red, while the e-mail version I received has
    var style_name = "title"
    Maybe you changed your message after posting it? No matter, I carry on
    and here's the result:
    tell application "Adobe InDesign CS4"
       tell document 1
         set theStyle to paragraph style "1.Bold Head 1"
         set applied paragraph style of paragraph 1 of selection to theStyle
         repeat with i from 2 to count of paragraphs of selection
           tell selection
             set applied paragraph style of paragraph i to ¬
               next style of applied paragraph style of paragraph (i - 1)
           end tell
         end repeat
       end tell
    end tell
    This works the same as yours with the "title" style, but let's go
    one more:
    tell application "Adobe InDesign CS4"
       tell document 1
         set theStyle to paragraph style "1.Bold Head 1"
         set applied paragraph style of paragraph 1 of selection to theStyle
         repeat with i from 2 to count of paragraphs of selection
           tell selection
             set applied paragraph style of paragraph i to ¬
               next style of applied paragraph style of paragraph (i - 1)
           end tell
         end repeat
       end tell
    end tell
    This works for any style, so I only need one script! Option-n is 
    available as a QuicKeys trigger and I use option for other paragraph 
    style assignments, so I'll assign it to that. Thanks!
    Roy

  • 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 ! 

  • [AS] How to change a paragraph style within any folder in Find Grep?

    I want to change both text and paragraph style
    I do that job very easily until I put paragraph styles in a folder
    How to express the paragraph style "passage" within the folder "1st" in AppleScript?
    In line 18 below, "1st:passage" may be wrong... so I've tried and search for an hour, but I can't get the answer..
    sorry for bad english
    my main()
    on main()
      mySnippet_test()
      myTeardown()
    end main
    on mySnippet_test()
              tell application "Adobe InDesign CS5.5"
                        set myDocument to document 1
                        set find grep preferences to nothing
                        set change grep preferences to nothing
                        set include footnotes of find change grep options to false
                        set include hidden layers of find change grep options to false
                        set include locked layers for find of find change grep options to false
                        set include locked stories for find of find change grep options to false
                        set include master pages of find change grep options to false
                        set find what of find grep preferences to "\\n"
                        set change to of change grep preferences to "\\r"
                        set applied paragraph style of change grep preferences to "1st:passage"
                        tell myDocument
      change grep
                        end tell
      --Clear the find/change preferences after the search.
                        set find grep preferences to nothing
                        set change grep preferences to nothing
              end tell
    end mySnippet_test
    on myTeardown()
    end myTeardown

    Replace the red line with… Replacing name strings to yours…
    set myStyle to paragraph style "Style A" of paragraph style group "Style Group 1" of myDocument
    set applied paragraph style of change grep preferences to myStyle

  • 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.

  • 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 to find paragraphs by using paragraph style name?

        How to get the Paragraph style UIDRef from paragraph style name.
    To find the paragraphs using Paragraph style i want UIDRef of paragraph style.Can some one help me..,

    IDocument *doc = GetExecutionContextSession()->GetActiveContext()->GetContextDocument();
    UIDRef ws = doc->GetDocWorkSpace();
    InterfacePtr<IStyleGroupManager> paraStyleNameTable(ws, IID_IPARASTYLEGROUPMANAGER);
    PMString styleName("someStyle");
    UID paraStyleUID = paraStyleNameTable->FindByName(styleName);
    if(paraStyleUID != kInvalidUID)
         //We found the style
         UIDRef styleRef(doc->GetDataBase(), paraStyleUID);

  • Using GREP to bold Date and Event Name

    Hi
    I am stumped at how to properly apply a bold style to a combination of dates and event names using GREP. I am including three examples below. I do have Paragraph and Characters styles set up. The area I would like to effect the change is in all caps. I am trying to add a bold style only to the dates and the title of the event with out changing the rest of the information.
    I started of with this GREP Style:
    \d{1,2}\/\d{1,2}|\d\-?\s|\u
    It is bolding the dates and the name of the event. But it's not bolding the small dash between events that have a beginning and end dates or the en dash. It is randomly bolding other numbers and capital letters that it should not. Very frustrating. Each time I alter the GREP Style above, it makes it worse. This is as close as I got to the desired effect. Any ideas how to fix this?
    12/6-8 — HEALING WEEKEND AT TRUE NORTH HOLISTIC CENTER.  Friday  11am-5pm. Private Integrated Healing sessions, Friday 6:30pm-Sunday noon. “Blue Christmas” Retreat: Coping with Sadness at the Holidays; Sunday 3-7pm. Public Integrated Reiki™ clinic. Hubbardston, MA  www.truenorthholisticcenter.org. (978) 820-1139.
    12/6-12/8 — READ AND PLAY MUSIC IN A WEEKEND! World famous seminars turns beginners into musicians, revitalizes and inspires even pro musicians. 169 Mass Ave, Boston. (781) 599-1476 or http://signup.understandingofmusic.com or [email protected]
    12/7 — REIKI CERTIFICATION. Wilton, NH. Libby Barnett, MSW. 32 years experience. Reiki Energy Medicine author. Notebook, pin, certificate awarded. Credit cards accepted. CEU’s/contact hours. Call (603) 654-2787 or www.reikienergy.com. Reiki II: 12/8

    Thanks! That works. I am using a paragraph style for the body and have a bold character style for the information that needs to be bolded. I notice there are some listings that uses a colon and the bolding continued into the description where the first period appears (see samples below). I added a colon (to the shorter GREP style you suggested) in addition to the perod and excalamation point to search for.. Now the bolding stops at the colon but does not include up to the word "CARRY" (see first example). The second example, the bolding should stop after "FAIRE" but cotinues to the word Wisdom because of the period.
    I wish there was a option in the GREP drop menu to search for All Caps only and not Any Uppercase Letter. Is it a case were I need to manually edit those instances so it conforms to the norm? Or is there away to modify the GREP expression ^.+?[.!] to also include other instance like the example below?
    I alread try to add an additional rule using the Postive Look Ahead and nothing. And using the Any Uppercase Letter option, either forces the text back to the begining looking unstylized or it forces any capital letters to be bolded.
    12/8-12/13 — WESTERN REIKI MASTERS: BE ATTUNED TO CARRY Japan’s Gendai Reiki lineage: Usui Mikao-Kan’Ichi Taketomi-Kimiko Koyama-Hiroshi Doi-Audrey Pearson. Learn to teach all 4 levels of Japan’s Gendai Reiki Ho. www.yogapathways.com. (508) 740-9870 or Facebook: ‘Gendai Reiki America’
    11/23 — PSYCHIC AND HOLISTIC FAIRE at Women of Wisdom. North Easton, MA. Psychics, angel readings, mediums, crystal healings, Gaiadon Heart, chair massage, Reiki and more! Sign yourself up for a few appointments and bring your friends! www.womenofwisdominc.com (508) 230-3680.

  • Do I need to use GREP for this?

    I have set up my TOC for my book just fine. In my Contents, the headings from each chapter are pulled in and used as the entries for the TOC, then followed by its page number.
    I would like to add a word (the word "Chapter") before each numbered contents entry. Would I use GREP styles for this?
    I'm using CS5.
    Thank you!

    You can create an autonumbered list format that includes text like "Chapter " along with numbers, for the TOC paragraph style, so no scripting needed. Search Google for terms like "InDesign numbered list format text," without quotes for details.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices
    cc2545 wrote:
    I have set up my TOC for my book just fine. In my Contents, the headings from each chapter are pulled in and used as the entries for the TOC, then followed by its page number.
    I would like to add a word (the word "Chapter") before each numbered contents entry. Would I use GREP styles for this?
    I'm using CS5.
    Thank you!

Maybe you are looking for