GREP for changing paragraph style?

Okay folks, I have another one for all you smart people out there. I think GREP can be used to change formatting in the following instance, but I have no idea how to set it up.
I have a very long document, essentially a phone book-type listing of names, phone numbers, addresses, well over 150 pages' worth. The paragraph styles are fairly simple, only two per listing. The name/phone number is bold with a right hand tab with leader dots to a phone number that is flush to the right side of the column. The following lines are flush left, not bold, but indented 6pts. I've placed the text file and assigned the entire thing the NameListing paragraph style. I'd like to use GREP to find the address lines and change them to the NameListingAddress paragraph style.
Here's a screen shot to give you an idea. The left column is formatted correctly with both styles, the right column is "raw", all paragraphs formatted with the NameListing paragraph style.
Is this an appropriate application for GREP? If so, how do I set it up to only change the paragraphs that "don't have tabs"? It would save me a crapload of time.
THANKS again! --Dina

If your intent here is to use the character style to trigger a variable, as I belive it is based on your other thread, you MUST apply the character style up to the first tab to pick up the text at the start of the paragraph. There are two approaches to automating the formatting after that, but it may be too late for you to be much help.
In cases where every listing has the same number of lines it makes sense to use a unique paragraph style name (not necessarily format -- base on on another) for each lline and make it its own paragraph. Set up "next styles" to rotate through the list so each line is assigned the correct style based on the style of its predecessor. You get the rotation to sart over by making the first line style the next style for the last line. This works for manual entry and can be applied to an entire block of placed text in a single operation by selecting the text, then right-clicking the name of the first style to be applied and choose Apply <stylename>, Then Next Style.This ONLY works if you have exactly the same number of paragraphs in each listing.
The other option is to use forced line breaks instread of paragraphs and use one style for the entire listing. Set a left indent and negative first line indent, create a character style for the part of the first line that you want to appear in your header and apply it Up To ^t^n (that's a little-known trick -- if you enter more than one character in the trigger for a nested style it will activate on the first instance of any of the characters listed that occurs, so for example if you enter the word cat, your style will end on the first, c, a or t that appears inthe paragraph. ^t is the metacharacter for tab, and ^n is for forced line break) so that the style will end at either the tab, if present, or the forced line break if there is no tab (if you use a right-indent tab instead of a regualr right aligned tab [tricky to do a leader, but that's another discussion] substitute ^y for the ^t), then add a nested Line Style for one line. That line style should use a second character style that is based on the first character style you created for the name text and has no other attributes if you want the line to be the same from end to end. Sounds more complex than it is, and will work for listings with variable lenghths. The trick is to repalce your paragraph returns with forced line breaks, and will require a little thinking.
If using separate paragraph styles for each line, you'd use the same technique of a nested style up to a tab for the first line, but there is no need to get fancier since it will apply to the whole line if there is no tab. The paragraph style, in this case, would carry all of the bold and size formatting (and no need for any indents), and the character style would be nothing more than a name that will allow you to use it in the variable.

Similar Messages

  • Defining a background color for a paragraph style

    Hello and please excuse this very basic question, but I am completely stumped.
    How do I simply define a background color for a paragraph style? I cannot use a table etc. because the styles are mapped during an XML conversion. Code lines should receive a gray background box to separate them from the text.
    Also, is there a way to force line breaks whithin words for a specific style? The text, formated in Courier, should just fill the space with a fixed width per character and break wherever the line ends.

    With some drawbacks it's doable using two paragraph tags.
    The first tag, e.g. "Line" is empty (no text), and it has a reference page graphic that's just a rectangle filled 100% with color and set to have a percentage tint so that the text will "show through" it.
    "Line" is also set to have a negative space below it, e.g. -12 points.
    "Code" paratag has the actual code text in it, and it's set to have a negative space above, e.g. -12 points.
    I've done projects where I have multiple Line paratags differing by the number of code lines needing to be shaded, e.g. Line1, Line2, Line3.
    Unfortunately there isn't a way to automatically have the line expand to the correct depth of the Code paragraph, although I believe this would probably be something that could be done as a Framescript, to run through a document and create new "line" paratags of the correct depth depending on how many Code paragraphs or lines are in the following paratag.

  • Changing Paragraph Style Export Tagging Options

    I'm having a heck of a time trying to get the "Split Document (EPUB only)" box checked for certain styles. I was hoping an experienced scripter may be able to help me solve what I'm sure is an easy fix.
    My code snippet is below:
    var doc = app.activeDocument;
    var par_styles = doc.paragraphStyles.everyItem().getElements();
    for (var i = 0; i < par_styles.length; i++) {
         par_styles[i].styleExportTagMap.splitDocument = true;
    In this example, I'd like to get the Split Document checkbox checked for every paragraph style in my document. However, apparently the paragraph style doesn't support the "styleExportTagMap" class, which is the only place I've found that the "splitDocument" property lives.
    I assume my ignorance arises from not knowing exactly what the styleExportTagMap(s) class does.
    Could anyone point me in the right direction?

    Seems like a hack, but it works.
    var
        doc = app.activeDocument,
        par_styles = doc.allParagraphStyles,
        i = 0;
    for ( i ; i < par_styles.length; i++ ) {
        par_styles [ i ].styleExportTagMaps.add ( "", "", "", "" ).splitDocument = true;
    Hope that helps.
    Marijan (tomaxxi)
    http://tomaxxi.com

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

  • GREP for changing a character

    Hi people,
    I have many lists like
    a) local,
    b) de ZEC y
    c) de Región Biogeográfica
    d) Escala local, o de estación
    how can I change the a and the bracket of this list to Italic with GREP. Can i select just a paragraph like Paragraph Style to apply GREP? I have some fear that if i change all (in a many pages document) it can do some damages.
    Maybe there is an easy way to do it...
    Any idea?
    Thanks and cheers,
    Sebastian

    Tons of ways. How about a paragraph style with a nested character style, up to the parenthesis or the tab/space after that? That's better than local formatting with italics, which will shows the dreaded '+' sign.
    But you were asking about the GREP expression ... How's this? Search:
    >^[a-d]\)\s
    -- replace with formatting only, italics (or a paragraph style with aforementioned nested char style!).
    The GREP meaning, left to right
    * '^' = start of paragraph
    * '[a-d]' everything from 'a' to 'd', if the lists go further than 'd' just put it there. I advise against blindly writing '[a-z]' --
    i just in case.
    * '\)' is the closing parenthesis. It has to be escaped with a backslash because parentheses are special characters in GREP search.
    * '\s' is any space character -- space, tab, soft return, thin space, etc. If you know for sure you always have a space next, use just that instead! Just enter a space. If you know for sure you always have a tab next, use '\t'. As before, better be safe than sorry.
    Hit 'Find next' and 'Change then find next' a couple of times, enough to reassure it isn't finding anything it shouldn't, only then hit 'Change all'.

  • 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

  • Is there a script to change paragraph style based on even/odd page

    Is there a script or way to have paragraph style change between 2 styles based on the text being on an even or odd page? 

    @JustMikey – as I understand your task, the problem has nothing to do with "special" paragraph styles, but (nearly) all with anchored objects (the images and parts of the gray bar) and appropriate margin settings.
    Just see the following IDML file I exported from InDesign CS5.5:
    Dropbox - ImagesAwayFromSpine-CS5.5.zip
    ImagesAwayFromSpine-CS5.5.zip
         ImagesAwayFromSpine-CS5.5.idml
         080731_Manchester-xxl_Grau.tif
    Of course you could add paragraph styles to format the data automatically or optimize in other ways.
    That's up to you. But you can see the principle:
    Inspect the Anchored Object Options for the image and the gray bar. Also the frame fitting options for the image.
    Note: See also the margin settings, that are not exactly mirrored on even and odd pages (for good reason).
    Uwe

  • How to change paragraph style

    I have a text frame selected and it contains a story having various pargraph styles applied.
    I want to get name of each paragraph style applied in it and replace each with some other styles.
    But when I am applying style only one style is applied to whole text frame .(i.e all existing styles are replaced with a single style).
    Please help me , if there is any way.
    Thanks

    It was not a criticism of your design choices. You have misread my comments, I am simply warning you from long experience. We have no idea of what you do or don't know, most people who come here have little and it is safer to assume they have none.
    Creating a Textbox, which is randomly sized and placed and contains no text, is not dissimilar to having a Textbox already in the document with Placeholder text in it that you click on and it is replaced by whatever you type. If your client is quite familiar with Pages they must be familiar with using Placeholders and with duplicating and resizing objects as required. It is just a way of getting around your problem.
    Obviously you have done something else, or you would not be getting the results you have. I keep my version of Pages 5.5.3 as installed for testing, I don't know what you have done that is different and can't tell without having the file.
    If you want me to look, email me via my blue name. If not, that's fine too.
    Peter

  • [JS, CS2] Find Text - Change Paragraph Style

    I have text supplied to me formated with <g>,< b>,<k> or <r> at the start of paragraphs, this represents different paragraph styles that need to be applied. <br /><br />I started a script below, but it comes up with an error at "app.findTextPreferences.findText" <br /><br />have a used the wrong function here? <br />Is there an easy way for it to run through all of them as well, or should I just repeat this script with < b>,<k> and <r><br /><br />var myDoc = app.activeDocument;<br />var greenBullet = ["<g>", "<g>"]<br />replaceGreen();<br /><br />function replaceGreen() {<br />for (i = 0; i < greenBullet.length; i++) {<br />            var myGreenArray = greenBullet[i];<br />            app.findTextPreferences.findText = myGreenArray[0];<br />            app.changeTextPreferences.changeTo = myGreenArray[1];<br />            app.changeTextPreferences.appliedCharacterStyle=myDoc.characteerStyles.item("OFI Body copy_GREEN BULLET");<br />            myDoc.changeText();<br />            }<br />}

    Thanks Dave!<br /><br />OK, Now I am getting this message when I run it:<br /><br />"A layer with this name already exists...<br />...     if (myPageItems[i]  instanceof TextFrame && myPageItems[i].itemLayer.name = "listings")"<br /><br />So it's trying to create a new layer called listings.<br />Also - it seems to want to move the items to that layer?<br /><br />var myDoc = app.activeDocument;<br />app.findPreferences = null;<br />app.changePreferences = null; <br /><br />myObjectStyle = myDoc.objectStyles.item("defaultText");<br />myPageItems = myDoc.allPageItems;<br />for (var i = myPageItems.length - 1; i >=0; i--) {<br />     if (myPageItems[i]  instanceof TextFrame && myPageItems[i].itemLayer.name = "listings") {<br />          myPageItems[i].applyObjectStyle(myObjectStyle);<br />     }<br />}<br /><br />myDoc.search("<g>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_GREEN BULLET"});<br />myDoc.search("<k>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_BLACK BULLET"});<br />myDoc.search("<r>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_RED BULLET"});<br />myDoc.search("< b>", false, false, undefined, undefined, {appliedParagraphStyle:"OFI Body copy_BLUE BULLET"});

  • [win][js][cs4]find/change paragraph styles without losing local overrides

    Hi guys i need a little help here.
    I created a javascript which will find and replace doc file paragraph styles with indesign paragraph styles. everything works fine but the problem is that when it applies the paragraph styles it loses all local overrides. i tried:
    changetext(false);
    but its not working is there some kind of conditional parameter that i can put in the changetext() function so that it wont clear local overrides?
    Thanks.
    CharlesD

    Thanks Kasyan. You're always there to save my day. Thank you very much...
    I slightly modify the script to go through all my paragraph styles that need to be replaced coz there are hundreds of them. Im not sure though if this is the best or is there any faster way to do this:
    replace("T1", "Text", "T1");
    replace("T", "Text", "T");
    replace("1", "Heads", "1");
    replace("2", "Heads", "2");
    function replace(input, folder, output) {
        var foundItem;   
        var doc = app.activeDocument;
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
        app.findGrepPreferences.findWhat = ".+";
        app.findGrepPreferences.appliedParagraphStyle = input;
        var foundItems = doc.findGrep();
        for (var i = 0; i < foundItems.length; i++) {
            foundItem = foundItems[i];
            foundItem.applyParagraphStyle(doc.paragraphStyleGroups.item(folder).paragraphStyles.item( output), false);
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;

  • What is the function to change paragraph styles?

    I'm trying to make a simple script that changes a raw data file that has preset Paragraph style already in the exported data from a HTML calender, and once its copied over into Indesign it changes the already existing paragraph style into a diffrent paragrph style?
    is this a simple script, I got no idea what the script function is to make the change of paragraphs.

    Would this work? or do I got the wrong function commands?
    var myInDesign = app
    var myDocument = app.activeDocument
    var myDocName = myDocument.name
    app.findParagraphStyle.caseSensitive = false;
    app.findParagraphStyle.wholeWord = false;
    app.findCharacterStyle.wholeWord = false;
    app.findCharacterStyle.caseSensitive = false;
    app.findParagraphStyle.findWhat = "SN.outabout.DAY-Gray";
    app.changeParagraphStyle.changeTo = "SN.Holiday-Day_of_the_week";
    app.documents.item(0).changeParagraphStyle();
    app.findParagraphStyle.findWhat = "SN.outabout.DATE";
    app.changeParagraphStyle.changeTo = "SN.Holiday-Month_and_Day";
    app.documents.item(0).changeParagraphStyle();
    app.findParagraphStyle.findWhat = "SN.listingsLT";
    app.changeParagraphStyle.changeTo = "SN.Holiday-Paragraph";
    app.documents.item(0).changeParagraphStyle();
    app.findCharacterStyle.findWhat = "SN.listingsBOLD";
    app.changeCharacterStyle.changeTo = "SN.Holiday-Title_Paragraph";
    app.documents.item(0).changeCharacterStyle();
    //myInCopy = CreateObject("InCopy.Application.CS3")  //Not sure if this would work, just crafting idea's.
    //var myDocument = myInCopy.ActiveDocument
    //var mySelection = myInCopy.Selection.Item(1)
    //var myStory = MySelection.ParentStory
    //var myText = myStory.Paragraphs.Item(1)
    //myStory.CheckOut
    //myText.ApplyParagraphStyle myDocument.ParagraphStyles.Item("zAPPROVED"), True
    //myStory.CheckIn
    Can I just do this with like a Nested If, then Statement?

  • Suppress highlighting for parent paragraph style

    When one paragraph style is based on another paragrash style, and you click inside the child style with the Type tool, both the parent and child styles are highlighted in the Paragraph Styles panel. This makes it confusing as to which paragraph style is actually applied to that paragraph. Is there a way to change this display so that only the style applied to the active paragraph is highlighted?

    What version of ID and OS X?
    You might want to file a bug: Adobe - Feature Request/Bug Report Form

  • TOC for ePub Paragraph style editing

    I'm trying to figure out if InDesign can allow us to editor the dynamic table of contents. What we have is basically this:
    Chapter number (unique paragraph style)
    Chapter title (unique paragraph style)
    First paragraph (unique paragraph style)
    We want the ToC that gets pulled up in a eBook reader to show this:
    Chapter 1: Chapter Title
    Chapter 2: Chapter Title
    Right now, InDesign seems to only export each as a specifc paragraph style, without setting them on the same line side by side. We get stuck with:
    Chapter 1
         Chapter Title
    Chapter 2
         Chapter Title
    Does anyone know of a way to export the ePub so it's what we want rather than this hirarchically broken way?

    This TOC issue has bugged me for years.
    I have been able to come up with certain workarounds, but only when my physical (print) TOC just happens to be set up exactly as I would like it displayed in the ePub (this is not always the case).
    It would be wonderful if there was a way for us to better control how the TOC info is output when exporting to ePub.
    For now, the fastest and easiest way to deal with this issue (for me anyway), is to manually update it in the ePub file after export.
    Cheers,
    Ron

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

  • XML import is changing paragraph styles?!

    After importing my translated XML-File the "copy"- Paragraph style is overwritten by my "Headline"- Paragraph style. Any Ideas why this issue is occuring? I hope the screenshot is kinda helpful in any way (simplified version of my problem) - best regards!

    On the paragraph styles panel or table styles panel, delete the style and replace with another style.

Maybe you are looking for

  • How To Restore If You Never Bought Lion?

    After an update my screen is now grey upon start up. The trouble I have is when I "CMD R" to go into recovery it wants me to put in the email address that downloaded Lion.  Well I never downloaded Lion, it was on the installation disc (which I dont h

  • Why I need a code for rent a film and where ist the code? (I dont have a card)

    Why I need a code for rent a film and where ist the code? (I dont have a card)

  • Sending photos from phone to pix place

    Before this recent update, I had no problem sending photos from my droid X to the online album storate at Pix Place. Now since the update, I have not been able how to send the photos.  Online album is not even a choice.

  • Receiver JDBC adapter to SELECT is null records?

    Hi, I have an interface with an Oracle database and I need to read only the records that have a null value in a field. I have created the mappings and all work fine except the selection for this records, in other words I need simulate in the where cl

  • Is Java in the repository or how do I install it?

    I have never successfully installed Java in Linux unless there is a repository package or it come installed. It seems to me that the Sun instructions are missing newbie information for sure. I have not installed Arch yet. I need to know if Java, win3