Find/change using end of paragraph marker /p

Folks,
We are attempting to remove a space at the end of a paragraph in unstructured documents.  If I enter ' \p' in the Find text field in the Find/Change dialog FrameMaker finds the the appropriate paragraphs.  If I then enter '\p' in the Change text field in the Find/Change dialog and click Change the space is removed.  However the target paragraphs style is also applied to the the following paragraph.  This occurs in FrameMaker 8,9 & 10.
If the Find/Change scenario above is followed with these two paragraphs the first paragraphs style is applied to the second paragraph.
paragraph 1 with a trailing space and using Heading 1 style
paragraph 2 using Heading 2 style
Any thoughts?
regards
Jon

JonEBe wrote:
Arnis,
Thanks!
Yes why bother indeed!  I am at the end of a rather lengthy process to convert the creation and output of Framemaker documents into a database with a web front end.  As part of this the existing documents are imported to save lengthy keying/rekeying.  The output from the system is then compared against the originals.  As a matter of course I stripped of leading or trailing spaces (it is amazing how many there are in a manually created/updated document) so we therefore have noisy comparison documents as a result.
BTW the trailing spaces are apparently a legacy of the conversion from WordPerfect.
My choices are to re-import without stripping the trailing space and remove them at a later date or create a script using the FDK, which I am very familiar with, and is the likely outcome!
Jon
Just a wild thought - a real GREP processor, not the mild imitation in FrameMaker, can find a construction like a space followed by a paragraph marker and delete the space without affecting the marker. The technique is a form of the "lookbehind" or "lookahead" feature. I'm zero-skilled at actually doing this beyond just mentioning it, but the technique might work in a MIF, or text conversion, of the file. Search Google for terms like "GREP lookbehind lookahead," without quotes.
Another possibility is that once the FrameMaker file is converted to the database, it would be possible to use a database command to remove the space.
HTH
Regards,
Peter
Peter Gold
KnowHow ProServices

Similar Messages

  • Insert End of Paragraph mark before any superscript number

    I am formatting a Bible for a client. The text was provided with verse numbers before each verse, but each chapter is one long paragraph. Now the client has decided they want each verse to begin a new paragraph. How can I globally insert an End of Paragraph mark before each superscrpt verse number?

    In case it helps, and for what it's worth, here's what I assumed:
    As in many bibles, the superscript verse number is simply mixed in the text, preceeding the first sentence of the verse. Could be anywhere, and there is no other special treatment involved. Like this:

  • Find / Change Replace "End of story" by Paragraph

    Hi tehre,
    I tried unsuccessfully to find out how to manage to put a paragraph to the end of story to the multiple textframes automatically. There must be some way! Am I right?
    Thank you!

    Hi Scott,
    See the IMG please to understand me more:
    Each textframe  has the "#" hidden character on the very end. I want to put there a paragraph to the very end of each textframe I selected. I imagined something like this:
    Open "Find / Change" dialog box
    Find the "#" {End of Story}
    And replace it by "¶ #" {Put the paragraph before the very End of Story}
    I am merging multiple textframes, copy them and put the text to the different indd document. But if there is not a paragraph on the end of the textframes which I am merging, all the text joins together and I have to put paragraphs manually there afterwards. {I am merging 4 textframes into one, so i have to put there at least 3 paragraphs. I have 350 items, which means about thousand paragraphs together to be put manually.}
    Runnig ID CS6.
    Thank you!

  • YAB - FM11 Find/Change using Selection drops selection after first find

    Yet another bug in FM11?
    If you are using a selection to limit the scope of a find/change, FM11 now drops the selection after the first find.  Consequently, it can't find anything else that matches as there is no more selection and you have to re-select again. What a PITA!
    In FM10 and earlier, FM would remember the selection and just keep searching until it reached the end of the selection.
    Can anybody verify this user-hostile (what's a QC test script?) behaviour in the latest pached version of FM11?

    I just changed modes in FM11 from strructured to unstructured. The problem does NOT occur in unstructured FM!

  • Script a find/change using a datasource

    So I wrote a program (C#) a few years ago that basically opens an InDesign Exchange file, does a find/replace based on a SQL table datasourse and then our graphics folks would just convert the completed INX file back to InDesign and ultimately to a PDF.  Too many steps.
    There are upwards of 2500 pieces of variable data in each file, so a product like DesignMerge is not practical.  Our data file basically consists of 2 fields [LookFor] and [ReplaceWith], I'd like an Indesign script that will just run through the data file and do a Find/Change for each record.  Is this doable and does anyone have any suggestions or starting points?
    Thanks!

    Yes, it's possible. In my oppinion the easiest approach is to export your data to a csv-file and read it by script. I posted an example in this thread.
    However, on PC, it's also possible to exchange data directly between InDesign and Excel, or Access (without csv). I did some tests: the main (InDesign) part was written in JS. Another (Excel) part that opens a workbook, reads records and closes it was written in VB (it is sent from the main part via doScript method). The VB script reads all used ranges puts, them into a string and returns it back to the JS via ScriptArgs.SetValue method (JS gets the string by app.scriptArgs.getValue method).

  • FIND/CHANGE - Applying Paragraph Style

    Hello,
    I used FIND/CHANGE to apply my paragraph style and when I apply the paragraph style... it applies the style to the entire line.
    For example,
    A. #70712       resulted to         A. #70712
    I only wanted the "#70712" to be changed to my style. I used the GREP search and entered #.+ and then I choose the paragraph style I want and clicked change all. The problem is that it changed all the text on that line and applied the paragraph style.
    Please help. Thank you very much.

    graphicsoc wrote:
    Hello,
    I used FIND/CHANGE to apply my paragraph style and when I apply the paragraph style... it applies the style to the entire line.
    For example,
    A. #70712       resulted to         A. #70712
    I only wanted the "#70712" to be changed to my style. I used the GREP search and entered #.+ and then I choose the paragraph style I want and clicked change all. The problem is that it changed all the text on that line and applied the paragraph style.
    Please help. Thank you very much.
    If I understand your request correctly:
    If your paragraph style uses a numbered list to create the "A." and the remainder of the paragraph consists of only "# 70712" that you type in manually (or place from an existing file), I believe that you you don't need GREP. You can format the auto-numbered list differently from the remainder of its paragraph, by specifying a character style for the number portion.
    To extract only the non-numbered portion of an auto-numbered paragraph, for a TOC, in the Table of Contents dialog box, open the bottom part by clicking More Options if necessary, and in the Numbered Paragraphs pull-down menu, select Exclude Numbers.
    Read more about Table of Contents in Help, and/or with a Google search for terms like "InDesign table of contents numbered list exclude numbers" without quotes.
    If you need additional special formatting "tricks" in the source paragraphs, or in the TOC entry paragraphs, look into Nested Styles and GREP
    Styles in Help or Google searches.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • 'Find/Change' fails for 'Change All'

    'Change All' fails where I use ' End of Paragraph' [^p] and 'Change Format'. Change/Find is fine but need to process a considerable amount of text.
    e.g.
    I am asking to change:
    ABC £1,000 ^t £1000
    to
    ABC £1,000 ^p £1000
    whilst changing format to new paragraph style, so it ends up like this:
    ABC £1,000
    £1000

    OK. Thank you fo your patience
    This is a real example.
    I have this in a spreadsheet: 
    I HJN
    £29,995
    8 DCN
    £5,995
    I ERK
    £29,995
    EBK I
    £29,995
    YEB I
    £29,995
    SOJ I
    £27,995
    I paste it into the InDesign text box and it looks like thus:
    I HJN >> £29,995
    8 DCN >> £5,995
    I ERK >> £29,995
    EBK I >> £29,995
    YEB I >> £29,995
    SOJ I >> £27,995
    ['>>' = invisible tab mark]
    If I do 'find' ^t and change to ^p whilst specifying different paragraph style [which you would have to invent to replicate], I get:
    I HJN
    £29,995
    8 DCN
    £5,995
    I ERK
    £29,995
    EBK I
    £29,995
    YEB I
    £29,995
    SOJ I
    £27,995
    But If I do it all in one go ['Change All'] Everything goes to the new style.

  • Deleting extra forced line breaks with Find/Change

    Ladies and Gentlemen,
    I'm importing word .doc that are text-heavy and the formatting is such that there are lots of extra forced line breaks creating a blank line between paragraphs.
    To avoid manually deleting the extra forced line breaks to eliminate the blank line of space between paragraphs, what are the best steps to doing this an easier way?
    Any advice on clear steps to do it using the find/change option?
    Thanks in advance as always..
    JRH

    Are you talking about two hard returns [Enter] in a row, or a soft and hard return [Shift + Enter] and [Enter]? A forced line break is a soft return, but most Word users would just hit the return key for an empty paragraph to get an empty line.
    In either case, you can do a simple text find change, if GREP intimidates you. Use the special characters menu to enter either two "end of paragraph" or a "forced line break" and "end of paragraph" markers into the find field and a single "end of paragraph" marker into the change field.
    This is included as part of the "Find/change by list" sample script which adds some other common cleanup functions like converting two spaces to one. The advantage to using GREP is it will find any number of consecutive paragraph end markers and convert to one in a single pass, while a text search must be run multiple times to catch the heavy handed author.
    Peter

  • How do I include the End of Paragraph character with the other characters in a GREP definition?

    I have a character style that changes the line spacing.  The GREP definition that applies it is a period.  This selects everything bu t the Endo of Paragrpah character (EOP).  The result is that the entire paragraph reformats but the last line of text has the wrong spacing.
    I am new to GREP and have not yet found a way to include the EOP character in the change.  I have tried  the statement :    .*$   but that has no affect.

    JES5910 wrote:
    Try defining a paragraph style with a smaller font and leading size then the default style and apply it to the pragraph using GREP definition of a period (all characters).
    That's exactly what I did. I started with 12/14 and changed to to a style using 8/9. Everything changed.
    There is no need to select all the text in a paragraph to assign a paragraph style since the style is aparagraph level attribute. You cannot have more than one paragraph style applied to a single paragraph, so it is IMPOSSIBLE that the end of paragraph marker has a different paragraph style applied than the rest of the paragraph. It IS possible, however, to apply a different character style or local formatting to it (and that's one reason it's better to use a triple-click instead of dragging to select an entire paragraph), so if the last line is not picking up the corrct spacing, the EOP character is either character styled or locally formatted.
    The only way you would know if this is the case is by selecting the EOP character, either as part of the entire paragraph, or by itself. If the paragraph style is then listed with a plus sign, there's local formatting applied. If not, check the character styles panel and I think you'll see a character style applied there (it would say mixed if you've selected the entire paragraph, unless of course you've applied the same character style to everything, which would be a major mistake).
    You can use GREP to remove the character style, if that's what it is, by searching for \r and in the change format set the character styel to [None]. This would work for all paragraphs regardless of waht the leading should be. If the incorrect specification is a local format, however, you would have to either select all text and remove local formatting (which might remove somethign you want, as well) or set up GREP searches to look for the \r with the correct paragraph style in the find formatting, then change the leading explicitly for that style inthe change formatting.

  • End of paragraph

    Hi ,
    I m facing problem in finding end of paragraph in text file through java like we do to find the end of file Using EOF like wise i want to find out the end of paragraph.
    Do u have any solutions for this.

    think about what would idenitfy the end of a paragraph
    think about how to read the file
    rinse and repeat
    heres a hint -
    if a new paragraph starts another one most likely just ended.

  • Find/Change Inserting paragraph break

    Hello
    I am trying to insert a paragraph mark between two lines of text using find/change
    The first line has a heading style and I want to insert an empty line (Paragraph) after it and before the next line (without changing any formatting)
    I am able to use enter the correct parameters in find but can't figure out what parameter to use in 'Change to"
    Forced line break doesn't produce what I want. Neither does standard carriage return (not sure what that is)
    I have tried both Text and Grep dialogs without success. Yes I read the help files.
    This will be simple for you guys but is stumping me.
    Any ideas oh brilliant ones?
    As usual Thanks much in advance

    Err, a paragraph mark? You mean a paragraph break?
    Anyhow, if you insist on Doing it Wrong, you can use ^p ("End of Paragraph") in the change field. So you might
    change ^p to ^p^p to insert a blank paragraph between each paragraph. For instance. But again, it is the wrong answer.
    Yes-a paragraph break.' Sorry for the imperfect terminology
    The first line is a heading style which I was advised in this forum to make into a 'list style' due to TOC issues
    The 'doing it wrong' paragraph is going to be used to anchor a graphic and then converted to a very small paragraph mark (nearly invisible) as advised in another article
    I did use the
    change ^p to ^p^p
    but it creating another list style as the paragraph break. Its ok. I went ahead and did it anyway and then manually changed all of those entries into a regular paragraph 'break'
    With 300 graphics I would like to automate this but.....
    Thanks for your reply

  • Find/Change Grep only finds one instance per paragraph, where am I going wrong?

    Hi,
    I've been using a Find/Change Grep to find any price with a comma and change that comma to a thin space (Newspaper's editorial style).
    But the Grep only finds the first instance of this per paragraph.
    Sample text...
    "$200,000 $200,000 $200,000.
    text at start of paragraph $200,000
    $200,000 text at end of paragraph
    tab     $200,000."
    In the sample the grep would miss the second and third price on the first line.
    I've been using...
    Find...
    (?<=\$)(\d{3})\,?(\d{3})
    also tried (\$\d{3})\,?(\d{3})
    Change to...
    $1~<$2
    Is there anything I can add to find these last two prices?
    I've been using this in combination with Batch Find Replace script, so different greps are set up for 5,6 and 7 digit numbers that start with $.
    Thanks.

    Try this,
    Find what: (?<=\x{0024})(\d{3})\,?(\d{3})
    Change to: $1~<$2
    Vandy

  • [JS CS3] Find/Change "[Basic Paragraph]" style

    I'm trying to find all occurances of the [Basic Paragraph] style and replace them with [No Paragraph Style]. I'm using:
    app.findTextPreferences.appliedParagraphStyle = "[Basic Paragraph Style]";
    app.changeTextPreferences.appliedParagraphStyle = "[No Paragraph Style]";
    I get the message "Invalid value for set property 'appliedParagraphStyle'. Expected String, ParagraphStyle or NothingEnum enumerator, but received "[Basic Paragraph Style]"."
    I've tried every combination of brackets, no brackets, quotes, no quotes, etc. It doesn't seem like this can be scripted, even though it can be done via find/change in InDesign. Am I banging my head against the wall? Does anyone know if this can be done?

    "[Basic Paragraph]" as shown in the code below doesn't work either. (the word "Style" actually snuck in as I was trying different variations. But no combination seems to work.
    If anyone knows that [Basic Paragraph] can or cannot be accessed via scripting, I'd like to know. Thanks.
    app.findTextPreferences.appliedParagraphStyle = "[Basic Paragraph]";
    app.changeTextPreferences.appliedParagraphStyle = "[No Paragraph Style]";

  • Finished script: Use grep find/change to fill in a supplied table of contents

    This script is now complete, and has been the subject of most of my previous posts. Just in case anyone wanted to know what the finished script ended as, here it is.
    Thanks so much to all. A lot of really helpful folks on this board are very responsible for the success of this task. This script is to be one of hopefully many in the creation of our records. But it's a huge leap forward. Thanks again to everyone that helped.
    Cheers,
    ~Nate
    Task:
    Automatically find town names in listings, and fill in table of contents template on page 2 accordingly.
    Example of page 2 toc, initially:
    Example of a page of content. The town names are what need to be referenced on the TOC:
    Example of page 2 toc once script is finished:
    Because of the need to include the transaction dates on the TOC (comes as a provided, tagged-text file), a simple Indesign-generated TOC can't be used alone.
    This script uses an Indesign-generated TOC that's on a master page called "T-tocGen" ... It then uses grep search and replaces to grab the needed information, and insert it into the page 2 TOC.
    The script will update a generated TOC and then search for an instance of a page number, and town name. The generated toc lists all included towns in the following format:
    (line start)## tab townName(line end)
    In Grep, this would be (please note, extra \ for \d and \t ... javascript needs that for some reason):
    ^\\d+\\t(.*)$
    After the script gets the info it needs from a found instance of the above, it replaces that line with "---", to prevent that line from being picked up once again.
    The script with then place the needed page number in it's rightful place on page 2, replacing the XX.
    A while loop is used to repeat the above process until there are no longer any instances of "^\\d+\\t(.*)$" present.
    Not every town runs every issue, so once the script is done, it removes all remaining instance of "XX" on the page 2 TOC.
    FINAL CODE:
    TOC replace
    This script will use grep find/change methods to apply page numbers in
    tocGen to the XX's on page2TOC.
    // define the text frame of generated TOC
        var tocGenFrame  = document.masterSpreads.item("T-tocGen").pages.item(0).textFrames.item(0);
    // udpate generated TOC ... store contents in tocGenStuff
        var tocGenStuff = updateTOCGen();
    // set variable for while loop
    var okGo = "1";
    // while okGo isn't 0
    while(okGo.length!=0)
    // get town info from tocGen
    getCurrentTown();
    // replace XX's with tocGen info
    replaceTown();
    // grep find ... any remaining towns with page numbers in tocGen?
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "^\\d+\\t(.*)$";
    // set current value of okGo ... with any instances of above grep find in tocGen
    okGo = tocGenFrame.findGrep();   
    // grep find/change all leftover XXs in page2TOC
    app.findGrepPreferences = app.changeGrepPreferences = null;       
    app.findGrepPreferences.findWhat = "^XX\\t";
    app.changeGrepPreferences.changeTo = "\\t";
    app.activeDocument.changeGrep();  
    // clear grep prefs
    app.findGrepPreferences = app.changeGrepPreferences = null;
    //  functions                  //
    function getCurrentTown()
    // grep options   
    app.findChangeGrepOptions.includeLockedLayersForFind = true;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findChangeGrepOptions.includeFootnotes = true;
    // grep find:  startLine anyDigits tab anyCharacters endLine
          app.findGrepPreferences = app.changeGrepPreferences = null;
          app.findGrepPreferences.findWhat = "^\\d+\\t(.*)$";
    // get grep find results      
    currentGen = tocGenFrame.findGrep();  
    // store grep results content into currentLine
    currentLine = currentGen[0].contents;
    // match to get array of grep found items
    currentMatch = currentGen[0].contents.match("^\\d+\\t(.*)$");
    // second found item is town name, store as currentTown
    currentTown = currentMatch[1];
    // change current line to --- now that data has been grabbed
    // this is because loop will continue as long as the above grep find yields a result
           app.findGrepPreferences.findWhat = "^\\d+\\t"+currentTown+"$";
                  app.changeGrepPreferences.changeTo = "---";
                tocGenFrame.changeGrep(); 
    function replaceTown()
    app.findChangeGrepOptions.includeLockedLayersForFind = true;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findChangeGrepOptions.includeFootnotes = true;
    // find: XX currentTown .... replace with: currentLine
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "^XX\\t"+currentTown+" \\(";
        app.changeGrepPreferences.changeTo = currentLine+" \(";
    app.activeDocument.changeGrep();   
    function updateTOCGen()
    //set vars ... toc text frame, toc master pag
        var tocGen  = document.masterSpreads.item("T-tocGen").pages.item(0).textFrames.item(0);
        var tocGenPage  = document.masterSpreads.item("T-tocGen").pages.item(0);
    //SELECT the text frame generatedTOC on the master TOC
        tocGen.select();
    //Update Table of Contents by script menu action:
        app.scriptMenuActions.itemByID(71442).invoke();
    //Deselect selection of text frame holding your TOC:
        app.select(null);
    //store contents of toc text frame in variable
        var tocGenText = tocGen.contents;
    //return contents of tocGen
        return tocGenText;

    Thanks for the reply.
    You are correct but the problem is there are three rows, One row is 100% black, the second is 60% black and the third is 40% black. I want to change the black to blue, the 60% black to an orange and the 40% black to a light shaded blue. In the find/change option you can select the tint you want to find and replace but yea.. does work on table cells.. oddly enough.

  • How to use character styles in the Find/Change JavaScripts?

    First, good luck to Ole. He's been so helpful (and such a good writer, too). All the best!
    My Find/Change JavaScripts are running into trouble at line 159 of the ExtendScript Toolkit. The script is searching for a particular font, to which it should then apply a character style. I'm using the format I see in Adobe's "FindChangeList" sample text, but the script is still hitting a wall. What am I doing wrong? I'd like to have a working method for searching, not only for fonts, but also for finding a particular character or paragraph style and then applying a new style.
    Simple stuff, but I'm roadblocked.
    Here is the script so far:
    //This script applies the DFKai character style to the Arial Unicode font.
    text {findWhat:"", appliedFont:"Arial Unicode MS", fontStyle:"Regular"} {appliedCharacterStyle:"DFKai"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find Unicode font; change to DFKai character style.
    Thanks for your help!
    Gary Niemeier

    You are absolutely correct. I don't know how those spaces got there! I copied the text from the "FindChangeList.txt" document, but somewhere along the way, a software program "helpfully" added the spaces. (Rest assured, it wasn't copied from AppleScript. I stick with JavaScript.) Anyway, the script now runs like a charm.
    My thanks to you! Another "newbie" mistake easily spotted, eh?
    One thing, though, if Adobe is reading this: please flesh out the "FindChangeList.txt" file for those who are not programmers/scripters. I'm just a normal InDesign user, and I really need examples of basic syntax in order to use the "Find/Change" script correctly. I'm referring to the syntax involved with finding or changing text with a certain character or paragraph style. I often search for styles, and those properties should be provided in the help file. A couple of samples are all that's needed. (I did read through the JavaScript reference guide provided by Adobe, and even in the "Find/Change" section, it did not provide this information!). Furthermore, I often search text for a specific font. Why isn't this syntax included as well? It would easy to do and would save users a lot of fumbling around.
    Thanks again, all the best.

Maybe you are looking for