Find and Replace Lines

I am running ID CS2. I have a document with several hundred lines, all the same size and justified left. I would like to do a find and replace and have the same lines replaced but centered. Every time I copy a centered line and do a replace, it replaces but not centered. Is there a way to do this?

However, Find/Change SHOULD be able to handle this. Make sure that you've pressed the "more options" button to show the formatting options.
Paste enough of the text into the find field to be sure it finds the right thing, then open the "find" format dialog and select the current alignment (remember, left aligned is not the same as left justified, which is justified text up to the last line, and then left align the last line). Leave the change field blank, and enter the new alignment option in the change options dialog.
If you haven't already set up styles, this would be a good time to do it. You can use Find/change to apply the style instead of just changing the alignment.
Peter

Similar Messages

  • Folder action to find and replace text and change line feeds

    I want to use a folder action to find and replace text and change Mac carriage returns to DOS line feeds inside text files.
    The text to be replaced is: "/Users/wim/Music/iTunes/iTunes Music/Music" (without the quotes)
    This text has to be removed (i.e. replaced by an empty string)
    The text occurs many times within each file.
    The files are playlists exported from iTunes in the M3U format (which are text files). They contain Mac carriage returns. These need to be changed to DOS line feeds.
    I have found the following two perl commands to achieve this:
    To find and replace text: perl -pi -w -e 's/THIS/THAT/g;' *.txt
    To change carriage returns to line feeds: perl -i -pe 's/\015/\015\012/g' mac-file
    I know that it's possible to make a folder action with Automator that executes a shell script.
    What I want to do is drop the exported playlists in M3U format in a folder so that the folder action will remove the right text and change the carriage returns.
    My questions are:
    Is it possible to make a folder action that executes command line commands instead of shell scripts?
    What is the correct syntax for the two commands when used in a folder action shell script? Especially, how do I escape the slashes (/) in the string to be removed?
    Thanks for your help

    Ok, I've include an applescript to run a shell command. The applesript command quoted form makes a string that will end up as a single string on the bash command line.  Depending on what you want to do, you may need multiple string on the bash command lines.  I've included some information on folder actions.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set desktopPath to (path to desktop) as string
        log "desktopPath = " & desktopPath
        set unixDesktopPath to POSIX path of desktopPath
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    How to set up a folder action.
    1) right click on folder. click on Enable folder actions
    2) Place script in
    /Library/Scripts/Folder Actions Scripts
    3) right click on folder. click on attach folder action
    pick your script.
    Create a new folder on the desktop & try.
    You can put multiple folder actions on a folder. There are other ways of doing this.
    Here is my test script:
    on adding folder items to this_folder after receiving dropped_items
        repeat with dropped_item_ref in dropped_items
           display dialog "dropped files is " & dropped_item_ref & " on folder " & this_folder
        end repeat
    end adding folder items to
    How to  make the text into an AppleScript program.
    Start the AppleScript Editor
    /Applications/AppleScript/Script Editor.app
    In Snow Leopard it's at: /Applications/Utilities/AppleScript Editor
    Copy the script text to the Applescript editor.
    Note: The ¬ is typed as option+return.  ption+return is the Applescript line continuation characters.
    You may need to retype these characters.
    Save the text to a file as an script and do not check any of the boxes below.

  • Find and Replace multiple line PHP comment

    Greeting everyone!
    Hopefully this question is asked in the right place.
    I have about 300 php files that have multiple line PHP
    comment that start with /* and end with this */. I want to remove
    all the comments since I am trying to reduce the file size as much
    as possible. The comments are no longer needed and I have tried
    many different configureation in the dreamweaver find and replace,
    but for the life of me I cannot seem to get it to work. I even
    tried useing regular expressions, but the astrick * is a wild card
    the the code tags contain an astrick.
    Is it possible to do this in dreamweaver, or will I need to
    hand edit every page?
    Thank for help
    example

    I am not sure of the exact syntax but open the find replace
    function on a page and play with find syntax search feature from
    the drop down menu . If I am not mistaken you should be able to to
    search from the beginning of a comment tag to the end of one and
    grab whats in between. From the help file
    Use the Find And Replace dialog box to search for text or
    tags in a document, and to replace the found material with other
    text or tags.
    Select Edit > Find And Replace.
    In the Search pop‑up menu, select Specific Tag.
    Select a specific tag or [any tag] from the pop‑up menu
    next to the Search pop‑up menu, or type a tag name in the
    text box.
    (Optional.) Limit the search with one of the following tag
    modifiers:
    With Attribute Specifies an attribute that must be in the tag
    for it to match. You can specify a particular value for the
    attribute or select [any value].
    Without Attribute Selects an attribute that must not be in
    the tag for it to match. For example, select this option to search
    for all img tags with no alt attribute.
    Containing Specifies text or a tag that must be contained
    within the original tag for it to match. For example, in the code
    <b><font size="4">heading 1</font></b>, the
    font tag is contained within the b tag.
    Not Containing Specifies text or a tag that must not be
    contained within the original tag for it to match.
    Inside Tag Specifies a tag that the target tag must be
    contained in for it to match.
    Not Inside Tag Specifies a tag that the target tag must not
    be contained in for it to match.
    (Optional.) To limit the search further, click the Plus (+)
    button and repeat step 3.
    If you didn’t apply any tag modifiers in steps 3 and 4,
    then click the Minus (-) button to remove the tag modifiers
    pop‑up menu.
    If you want to perform an action when the tag is found (such
    as removing or replacing the tag), select the action from the
    Action pop‑up menu and, if applicable, specify any additional
    information necessary to perform the action.

  • Find and Replace Issue Help Requested.

    Hi all. I've been digging around for a couple of days and
    can't seem to figure this one out. For starters, I have already
    looked at the Regular Expression syntax and tried the MS word
    clean-up option, but no luck. We have about 1,500 pages of content.
    They are in DNN, so the pages are created dynamically.
    Unfortunately, the page content was written in Word and then dumped
    in DNN. We are trying to clean up the pages. We are grabbing the
    content from Dot Net Nuke and putting it into Dreamweaver 8.0.2.
    Then we are manually cleaning out things like:
    <?xml:namespace prefix = o ns =
    "urn:schemas-microsoft-com:office:office" />
    and
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"
    align=left>
    We are using the Find and Replace funtion in Dreamweaver to
    clean out these commands, but I know from the documentation, there
    is an easier way to clean these pages.
    Bottom Line: Since the pages are dynamically built, I know I
    have to grab the page content and put it in Dreamweaver manually
    and then put it back in DNN, but I am trying to find a way (using
    Regular Expressions or something) to look for all the little
    variances of MSO, <?XML, etc. in a straight shot. I would like
    to find a way to use a wild card to look for all tags that have MSO
    or Microsoft or ?XML in them and then replace them with a null
    value. From what I can tell, the Find would have to use a wildcard
    because the advanced find features don't carry what I am looking
    for. Something like Find \<?xml * [<-wildcard] to \> to
    grab the entire tag. The Find tag command doesn't work because the
    tags I need aren't listed. Also, because the content is dynamic, I
    can't do a Fins and Replace against the entire site for these
    commands, but it would be nice to "Find" all of these items with a
    single pass since the "Replace" value is always null.
    The wildcard syntax and multiple Find instances are the main
    questions. The wildcards seem to be character or space specific.
    Sorry for the long explanation - I just don't want to waste
    anyone's time typing responses to things I've already tried to do.
    Thanks in advance for any help. This is my first time back in
    the forums in about 4 years.

    sadamec1 wrote:
    > Well David, you Findmaster - it worked! (At least it
    found and highlighted the
    > code). Now, I need to dig through what you sent me and
    compare it against my
    > regular expression definitions to find out how to grab
    the rest of these
    > phrases. You're the best. Thank you!
    Glad that it did the trick. Just to help you understand what
    I did,
    there are two main sections, as follows:
    <\?xml[^>]+>
    and
    <[^>]+(?=class=Mso)[^>]+>
    They are separated by a vertical pipe (|), so they simply act
    as
    alternatives.
    The first one searches for <?xml followed by anything
    except a closing
    bracket until it reaches the first closing bracket.
    The second one is more complex. It begins with this:
    <[^>]+
    This simply looks for an opening bracket followed by anything
    other than
    a closing bracket. What makes it more intelligent is the next
    bit:
    (?=class=Mso)
    This does a forward search for "class=Mso". It's then
    followed by this
    again:
    [^>]+>
    That finds anything except a closing bracket followed by a
    closing bracket.
    The bit that you need to experiment with is (?=...). It's
    technically
    called a "forward lookaround". The effect is that the second
    half of the
    regex finds <....class=Mso....>.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • Find and Replace HS5.5

    How do I include a line feed in the replace section of the
    find and replace feature of Homesite 5.5?
    Converting many lengthy files from <pre> and <tt>
    formats into CSS. Presently the target pages have paragraphs broken
    into short lines of text with CR/LF's on every line. I wish to
    revert the paragraph back to 'wrapped' text with a single CR at the
    end of the paragraph.
    I can 'find' and eliminate the " ¶ " symbol from each
    line, but I do not know how to "replace " text that should include
    this symbol.
    text</p><p>¶
    This is some sample text to¶
    show graphically the problem¶
    I am having.</p><p>¶
    New Paragraph¶
    When what I want is :-
    <p>This is some sample text to show graphically , the
    problem I am having.</p>¶
    <p>New paragraph
    Presently I can add hash marks (##) where I wish the
    paragraph to end. I then globally remove all the "¶"'symbols
    that appear in the text. What I want to do now is replace the ##
    with code which would produce the following two lines
    </p>¶
    <p>
    I have tried many different codes, such as chr(13) and \r,
    but they all just insert the code as straight text.
    Can anyone clue me in?
    Thanks, gil d

    as far as special chars in simple F-and-R, I replace some
    non-ascii chars by copying from a doc and pasting into the dialog
    field.
    That wouldn't work for CR/LF, so you have to use the extended
    search and replace there as you found out.
    Note there is also a function for "Replace Double Spacing
    with Single Spacing" (on the menu, under Search).
    Probably no help for this case, but good to know.
    BTW, be careful with your extended search and replace on
    CR/LF. If your lines don't end in a space and a CR/LF, you might
    want to replace CR/LFs with a space. Otherwise the last word of one
    line might be butted against the first word in the next line with
    no space when the CR/LF is removed.
    Of course that's not a great solution since it adds a lot of
    spaces where you have CR/LFs, and you may not want them all
    there...
    There is a Remove Returns script that might be of use to you.
    It's a lot more manual than you probably want for doing lots of
    files.
    http://www.wilk4.com/asp4hs/list5.htm#removereturns
    let us know here if you find some better solution please,
    good luck,
    jeff

  • Find and replace by text and style

    We have a fairly large RH HTML project (300+ topics so far)
    most of which have a specific heading in Heading2 style. We want to
    change all of these to a style based on Heading2, but not use the
    Heading2 style b/c we don't want them to show up in the TOC. I have
    created a new style and can obviously open every topic and manually
    select and change each one - but I'm hoping that one of your RH
    gurus will tell me an easier way. Is there anything comparable to
    MS Words Find/Replace that will search the whole project for a
    specific word in a specific style?

    RoboHelp's Multi-File Find and Replace (in the Tools tab)
    should be suitable for this job, and you can control each
    occurrence as you choose. (Where this RH utility fails is when your
    search string might sit on more than one line, which won't be the
    case here.)
    You'll run two replacement passes (spaces added to < &
    > tags for proper viewing in this forum):
    Replace < h2 > with < p class=YourNewStyle >
    Replace < /h2 > with < /p >
    The < h2 > and < /h2 > strings will never be
    split between lines, so RH will catch every one.
    BTW, Add me to the list of FAR boosters; it'll let you change
    case, change file names, etc., etc., etc. Great tool!
    Good luck,
    Leon

  • VBA Word Find and Replace characters but excluding certain characters

    I am trying to write VBA code in Word that I will eventually run from a VBA Excel module. The aim of the project is to find specific strings in the open Word document that have length of either one or two characters and are of a certain format, and replace
    them with other strings in the same format. This is to do with transposing (i.e. changing the musical key) of chord symbols in a songsheet in Word. The Find and Replace strings are contained in ranges in an Excel workbook, which is why I want to eventually
    run the code from Excel. I'm much more experienced in writing VBA code in Excel than in Word, and I'm fairly confident with transferring the 'Word VBA' code into an Excel module.
    At the moment I'm trying out code entirely in Word, and I've come across a stumbling block. For example, I want it to Find "A" and replace with "B",
    BUT only if the "A" is NOT followed by "#" (sharp) or "b" (flat).
    Here is the code I've got in Word VBA, which I obtained by editing code produced by the recorder:
    Sub F_R()
    'Find text must have specific font
    With Selection.Find.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Replacement text must have specific font
    With Selection.Find.Replacement.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Find & Replace strings
    With Selection.Find
    .Text = "A" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Replacement.Text = "B" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = True
    .MatchWholeWord = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub
    For the Find & Replace section I want to do something like:
    With Selection.Find
    .Text = "A"
    .Text <> "A#"
    .Text <> "Ab"
    .Replacement.Text = "B"
    End With
    - but this produces a syntax error, presumably because you can have only one .Text line (or it won't accept <>?)
    I tried adopting the way of excluding chars when using the Like operator, and while it compiles, it will not replace
    any "A":
    With Selection.Find
    .Text = "A[!b#]"
    .Replacement.Text = "B"
    End With
    I suspect that I'm going to have to change tack completely in the way I'm doing this. Do you have any suggestions, please?
    The chord names/symbols are preceded/succeeded by either spaces or paragraph returns and can look like these, for example (all Font Bold and Underlined words only):
    C<sup>7</sup>
    Dm<sup>7</sup>
    Eb<sup>-5</sup>
    Bb<sup>+11</sup>
    F#m<sup>7</sup>
    i.e. [ABCDEFG][b # | optional][m |optional][- + | superscript, optional][2 3
    5 6 7 9 11 13 | superscript, optional]
    The crux of my problem is that the note A should be treated as entirely distinct from Ab or A# (and similar for other flattened/sharpened notes).
    Sorry for long post.

    Hi Ian,
    It is not easy to find Microsoft forums. However this forum is for the Visual Studio Net version. 
    Try this forum for VBA.
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    Success
    Cor

  • Batch Edit Multiple HTML files | Find and Replace

    Hi,
    I would like to use Automator to automate (I know that sounds redundant) the following process.
    1. Take a group of html files
    2. Open each file so it can find and replace the script of any image folders
    Example:
    Change: img src="home_files/photo.jpg" to img src="images/photo.jpg"
    3. Save & Close each file
    I assume this this would have to be done in either AppleScript or Cocoa.
    Any help would be greatly appreciated.
    Thanks in advance.

    you most definitely don't need Cocoa for something like that. if all you need is a straightforward search and replace in a bunch of html files you can easily do this with a shell script. If you need some more involved search and replace you have to explain what it is exactly that you want.
    to automate direct search and replace you can do something along the following lines in automator
    1. get selected finder items (this will select your html files)
    2. run shell script action with input passed as arguments
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    for f in "$@"
    do
    fl=`echo "$f"`
    sed 's%home_files/photo.jpg%images/photo.jpg%g' $f > /users/$USER/.tmp.txt
    cat /users/$USER/.tmp.txt > "$fl"
    done
    rm /users/$USER/.tmp.txt</pre>

  • How to use Microsoft Word's Find and Replace with HTML tags?

    Hello to all!
    I'm trying to figure out how to use the find and replace function in Word to replace html tags. I'd like to be able to change something like this:
    <span class="B01-K-ITAL">random text</span>
    To something like this:
    <em>random text</em>
    I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly.
    Anyone able to lend a hand?

    Here is my latest regular expression with Perl.   I think it matches the spirit of the request in the original post.
    Note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.
    perl -0660pe 's^<[sS][pP][aA][nN]\s+class="B01-K-ITAL"\s*>(.*?)</[sS][pP][aA][nN]>^<em>$1</em>^gs' i.html >|o.html
    input text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <span class="B01-K-ITAL">#1 one line</span> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <span class="B01-K-ITAL">#2 don't be greedy</span> <span class="B01-K-ITAL">$3 multiline text</span> <span class="B01-K-ITAL">#4 multiline tag. I believe html allow a carriage return in white space of tags</span> <span class="B01-K-ITAL">#5 split after the class tag. optional white space</span> <sPan class="B01-K-ITAL">#6 mixed case tag</Span> <p>no text #7</p><span class="B01-K-ITAL"></span> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>
    output text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <em>#1 one line</em> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <em>#2 don't be greedy</em> <em>$3 multiline text</em> <em>#4 multiline tag. I believe html allow a carriage return in white space of tags</em> <em>#5 split after the class tag. optional white space</em> <em>#6 mixed case tag</em> <p>no text #7</p><em></em> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>

  • Find and replace text in multiple Photoshop files?

    Hi there,
    Let us say I have six Photoshop files: 1.psd, 2.psd, ..., 6.psd. All of these files contain the word “LoremIpsum” in random text layers, within each document. Is there a way I can search for “LoremIpsum” in all documents and replace it with “Dolor Sit Amet”, all in one go? This is just an example, I need to replace various words, not just one.
    I have tried "batch find and replace" software (including powerful tools like Power Grep) but they do not work with psd files… Is there a javascript of external plugin for this kind of task?
    Thanks!

    You’re welcome, advice given here is free.
    If you want to donate something nonetheless you could do so over at
    http://ps-scripts.com/bb/
    Many of the same people used to contribute there as here and I for one have benefitted considerably from their generous advice on Scripting issues.
    A Script can read (or create) txt files, but I do not have a lot of experience with this.
    This might work (amend the line »var theTexts = readPref ("….txt", false);« according to your txt-file’s path):
    // replace text elements in type layers;
    // 2013, use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
              for (var n = 0; n < app.documents.length; n++) {
                        app.activeDocument = app.documents[n];
                        app.activeDocument.suspendHistory("replace text", "main()")
    // the opertation;
    function main () {
              var myDocument = app.activeDocument;
              var theTexts = readPref ("….txt", false);
              var theArray1 = theTexts.slice(0, Math.round(theTexts.length/2));
              var theArray2 = theTexts.slice(Math.round(theTexts.length/2), theTexts.length);
              alert (theArray1.join("\n")+"\n\n\n"+theArray2.join("\n"))
              for (var b = 0; b < theArray1.length; b++) {
                        replaceText (theArray1[b], theArray2[b])
    ////// reoplace text //////
    function replaceText (replaceThis, replaceWith) {
    // =======================================================
    var idreplace = stringIDToTypeID( "replace" );
        var desc22 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref3 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idreplace = stringIDToTypeID( "replace" );
            ref3.putProperty( idPrpr, idreplace );
            var idTxLr = charIDToTypeID( "TxLr" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idAl = charIDToTypeID( "Al  " );
            ref3.putEnumerated( idTxLr, idOrdn, idAl );
        desc22.putReference( idnull, ref3 );
        var idUsng = charIDToTypeID( "Usng" );
            var desc23 = new ActionDescriptor();
            var idfind = stringIDToTypeID( "find" );
            desc23.putString( idfind, replaceThis );
            var idreplace = stringIDToTypeID( "replace" );
            desc23.putString( idreplace, replaceWith );
            var idcheckAll = stringIDToTypeID( "checkAll" );
            desc23.putBoolean( idcheckAll, true );
            var idFwd = charIDToTypeID( "Fwd " );
            desc23.putBoolean( idFwd, true );
            var idcaseSensitive = stringIDToTypeID( "caseSensitive" );
            desc23.putBoolean( idcaseSensitive, false );
            var idwholeWord = stringIDToTypeID( "wholeWord" );
            desc23.putBoolean( idwholeWord, false );
            var idignoreAccents = stringIDToTypeID( "ignoreAccents" );
            desc23.putBoolean( idignoreAccents, true );
        var idfindReplace = stringIDToTypeID( "findReplace" );
        desc22.putObject( idUsng, idfindReplace, desc23 );
    executeAction( idreplace, desc22, DialogModes.NO );
    ////// read prefs file //////
    function readPref (thePath, binary) {
      if (File(thePath).exists == true) {
        var file = File(thePath);
        file.open("r");
        if (binary == true) {file.encoding= 'BINARY'};
        var theText = file.read();
        file.close();
        return String(theText).split(",")
    In this case the comma is used to split the text into Strings in Arrays, if your search/replace texts include commas you could use something else, I guess.

  • How can i find and replace xml tags?

    Hi, i am using xml in my workflow and want to be able to remove certain tags if they contain particular text.
    here is an example of my xml structure…
    <entry>
        <name>DEFAULT</name>
        <tel>DEFAULT</tel>
        <address>DEFAULT</address>
    </entry>
    I am using this initial structure to set the paragraph styles to be followed when the xml data is imported.
    This leaves DEFAULT in place wherever an entry doesn't have any content for that field.
    I want to be able to import my XML then run a script that removes any tags that include DEFAULT, - I need the entire xml tag to be removed not just the text, if i do a normal find and replace it will only remove the text not the tags which is causing problems with styling. I also want to remove the end of para/return (^p) that i've placed at the end of the line. So it would be the same as opening up story editor and removing the content + tags + hard return in there, but i want to automate the process…
    So i think this is what i need to search for in each case
    "<name>DEFAULT</name>^p"
    and i want to replace it with nothing ""
    Can this be done through scripting (ideally javascript)?
    I have a little knowledge of javascript but am not sure how to search and target that kind of string in indesign...
    using indesign cs5
    many thanks

    Hi,
    Script should do it in two steps:
    1. find all occurences of i.e. ">DEFAULT<"
    2. remove whole paragraph which is a found_text's container.
    For example this way -JS - (a textFrame filled with your text should be selected) :
    var mStory = app.selection[0].parentStory;
    app.findTextPreferences =  null;
    app.findTextPreferences.findWhat = ">DEFAULT<";
    var myF = mStory.findText();
    var count = myF.length;
    while (count--)
         myF[count].paragraphs[0].remove();
    rgds

  • Batch-find-and-replace.jsx

    Hi there, I wrote a batch-processing script for find change queries and thought I share it with you. You can get it over here 
    You can process GREP, TEXT, GLYPH and OBJECT searches. 
    Purpouse
    While creating books in InDesign with several documents we always come across some find change queries that need to be used again, and again, and again. To make this process easier you can just grab their names and put them into a list. The script will than try to process all your queries in one click. 
    prerequisites
    make sure you have a toml file.
    make sure the toml file is next to the script.
    make sure the toml file has the right formatting (see below in section TOML)
    if you want the script to autoexecute (without toml file selection), make sure the .toml file has the right name: "batch-find-and-replace.toml"
    make sure your fcqueries work right
    Usage
    Place the script and the toml file into your Scripts Panel Folder 
    define some find and change queries and save them via the InDesign dialogue.
    get the xml file names and add them to the "batch-find-and-replace.toml" file in the right spot. text search goes into text.files = [], grep search goes into grep.files = [] and so on. Make shure to remove the .xml from the filename. You can find these files on:
    Mac OS Users[username]\Library\Preferences\Adobe InDesign[Version][Language]\Find-Change Queries[query type] 
    Windows XP Documents and Settings[username]\Application Data\Adobe\InDesign[Version][Language]\Find-Change Queries[query type] 
    Windows Vista and Windows 7 Users[username]\AppData\Roaming\Adobe\InDesign[Version][Language]\Find-Change Queries[query type] 
    the .toml file should be located next to the script file and have the  appropriate name (batch-find-and-replace.toml). If so the script wont ask for the toml file and process the data right away. If not the script will ask you to select the .toml file.
    Thats it. Watch the magick happen.
    TOML
    Tom's Obvious, Minimal Language is a simple markup language that makes settings human readable. It is still in development and may change a lot. But still. It is a pretty easy language and can be learned by anyone.
    The basic toml filer looks like this: 
    # these are the basic settings
    # the MUST be there
    do_text = true
    do_grep = true
    do_glyph = true
    do_object = false
    # now the file names
    # they have to be in one line
    # the toml specs say you can break lines in arrays
    # but the toml.js does not allow that at the moment
    [text]
    files = ["my_first_text_find_and_change","another one"]
    [grep]
    files = ["somegrepsearch", "find tabs", "something else"]
    [glyph]
    files = []
    [objects]
    files = []
    MUST HAVE Settings
    With the do_text, do_object, do_grep and do_glyph you can define if the script should do the corresponding find and replace. Set them to true or false.
    CAN HAVE Settings
    In the [text],[grep],[glyph] and [objects] areas you can define the filenames that should be processed. Make sure the filenames are written right. If there is a file mentioned that does not exist the script will throw an error. It will try to process all the .xml files it can find.
    !IMPORTANT! you MUST remove the .xml from the filename in the list as shown above.
    The Script is here --> https://raw.github.com/...find-and-replace.jsx
    The basic .toml file here --> https://raw.github.com/...ind-and-replace.toml
    The Readme here --> https://github.com/...lob/master/README.md
    And the whole package here --> https://github.com/...e/archive/master.zip

    Great script, it worked perfectly with grep, text, glyph, not only worked with OBJECTS, because I do the same operation and does not work. Can you give me a hand? Thank you.
    In arquivo.toml is thus:
    # These are the basic settings
    # The MUST be there
    do_text = true
    do_grep = false
    do_glyph = false
    do_object = true
    do_all_docs = false
    # Now the file names
    # They have to be in one line
    # TomL the specs say you can break lines in arrays
    # But does not allow the toml.js que momento
    [text]
    files = ["_OVER_BLACK_TXT", "_OVER_CORPROF_TXT"]
    [grep]
    files = []
    [glyph]
    files = []
    [object]
    files = ["_OVER_BLACK_FILL", "_OVER_BLACK_STRK"]
    This is the image of the Scripts Panel folder:

  • How can I perform a find and replace against all embedded links?

    Hi -
    We have a project which links to another project. The URL for the linked to project has changed, and now all hyperlinks fail when clicked.
    Yes - I can edit each and every link, but the person who set this up has literally hundreds of links in this project which now need to be changed. Please save my sanity and tell me there is a way to update all links programatically (replace infomoto.mot.com/robo/projects/iccs-bcs with infomoto.mot.com/iccs) in all places it is referenced.
    Thanks much,
    Anahid

    In theory you can use the built in Multi File Find and Replace as the string should be on one line. Personally I would use FAR from http://www.helpware.net/FAR and search using Start With / End With and Must Contain to ensure the string will be found even if it is split over two lines. You could also use BKReplaceEm which is free.
    Backup up your project before you start. Tools like this can fix issues in seconds, they can also wreck your project in seconds.
    See www.grainge.org for RoboHelp and Authoring tips
    Follow me @petergrainge

  • Reformatting files in Dreamweaver: Batch series of .dwr files (find and replace) consecutively

    I have to do complicated reformatting of an entire site. It's been simplified to a series of find and replace tasks for each file. Each find and replace string has been saved as a .dwr file. Currently I have to load and execute each .dwr file.
    How do you batch process or automate this task in Dreamweaver? In other words, queue up a series of .dwr files to be executed consecutively?

    OK here we go.
    This example, a simple Dreamweaver  Command Extension, will execute two Find and Replace commands in one go. (It can be any number of Find and Replace commands.)
    The first command replaces "the" and "this" with "phe" and "phis". The second command replaces <ul> ... </ul> with <ol> ... </ol>. (These of course can be any Find and Replace.)
    You need two files: a HTML file (for the  UI) and a Javascript file (for actions). I named them "Find and Replace Test.html" and "Find and Replace Test.js". (They can be any name.)
    Find and Replace Test.html
    <!DOCTYPE HTML SYSTEM "-//Adobe//DWExtension layout-engine 10.0//dialog">
    <HTML>
    <HEAD>
    <Title>Find and Replace Test</Title>
    <script src="Find and Replace Test.js"></script>
    </HEAD>
    <BODY>
    <form>
         <p>Are you sure?</p>
    </form>
    </BODY>
    </HTML>
    Find and Replace Test.js
    function canAcceptCommand() {
        return true;
    function commandButtons() {
        return new Array("Go!", "doIt()", "Cancel", "window.close()");
    function doIt() {
        dreamweaver.setUpFindReplace({
            searchString: "th(e|is)",
            replaceString: "ph$1",
            searchWhat: "document",
            searchSource: true,
            useRegularExpressions: true
        dreamweaver.replaceAll();
        dreamweaver.setUpFindReplace({
            searchString: "<(/?)ul>",
            replaceString: "<$1ol>",
            searchWhat: "document",
            searchSource: true,
            useRegularExpressions: true
        dreamweaver.replaceAll();
        window.close();
    Basically you can call any number of this pair of functions in the script:
    dreamweaver.setUpFindReplace(findAndReplaceObject);
    dreamweaver.replaceAll();
    Place these HTML and JS files in this directory:
    Dreamweaver App Directory/Configuration/Commands/ 
    Then in Dreamweaver, open "Insert" window. (You need to have a HTML file open in order to make the Insert window active.) At the top of the Insert window there's a category dropdown menu  ("Common" etc.). Do alt + click (ctrl + click) - then you'll see an item "Reload Extenesions" at the bottom of the dropdown. This will load this extension to DW. (Alternatively you can restart DW to load the extension.)
    Now it's ready to run the Extension. Open a HTML document you want to modify. Go to "Commands" on the menu bar. At the bottom of the dropdown there should be an item "Find and Replace Test". Select and enjoy
    Notes
    This example is set to perform the Find and Replace on the current document. You can change the scope to the entire site, or the selected files, etc, just like in the Find and Replace dialogue box. The API doc is here: http://help.adobe.com/en_US/dreamweaver/cs/apiref/WS5b3ccc516d4fbf351e63e3d117f9e09bcf-7ed a.html
    You can use dreamweaver.setUpComplexFindReplace(xmlQueryString) command instead. xmlQueryString is basically <dwquery> ... </dwquery> in your .dwr files, you can copy from your .dwr files. However xmlQueryString needs to be one continuous string (no line breaks), which can be a pain The doc: http://help.adobe.com/en_US/dreamweaver/cs/apiref/WS5b3ccc516d4fbf351e63e3d117f9e09bcf-7ed 9.html
    Command Extension general example in the doc: http://help.adobe.com/en_US/dreamweaver/cs/extend/WS5b3ccc516d4fbf351e63e3d117f53d6ec3-7fe 6.html
    I hope all of these make sense...
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • In the new Numbers, can I find and replace within formulas like I used to in Numbers'09?

    I use Numbers with quite long formulas with reference to other tables. With Numbers'09, it was extremely useful to copy formulas and then use "find and replace" to change the terms within.
    Did they remove this option? I don't seem to be able to do that with the new Version.
    If it's still there, where do I find it?
    If it's not there.... why would they remove it.
    Thanks

    Basically, I use it for payroll, taxes, and so on... I have one sheet per employee (which compiles their weekly payroll). I have then different sheets which makes the quarterly taxes calculation (state and federal taxes - 941, 940, W2, disability,  UI, paystubs, tracks payments and deadlines, etc... ). It took me awhile to write all of the formulas, but now it does everything for me.
    When I add an employee. I have to add a sheet, but also add a line in the calculation sheets. Because all the employee sheets are the same format, all I need to do (or used to now) was to copy the line above, and just change the reference name of the employee sheet  within the formula (because there are several terms that are looked up, the reference name comes several time in the formula)... changing it manually is really annoying. What was taking me a minute or so, before, now takes me about 20 minutes. (between the different sheets, there are about between 75 to 100 changes in formulas per new employee - so the "find and replace" in formula only, was extremely useful).

Maybe you are looking for