Find and replace in rtf file

hello
I would like to replace a bookmarks that are already created in a rtf template file
I Know how to read the rtf file ,It is just that i can't figure out how to rplace a word inside this file
here is my code
File docFile = new File("C:\\test.rtf");
        FileReader reader = null;
        try {
            reader = new FileReader(docFile);
             } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        javax.swing.text.rtf.RTFEditorKit kit = new RTFEditorKit();
       // Document doc = jEditorPane1.getDocument();
        Document doc =  kit.createDefaultDocument();
        try {
            kit.read(reader, doc, 0);
            jEditorPane1.setText(doc.getText(0,doc.getLength()));
        } catch (BadLocationException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }thank you in advance

thank y every one for being fast but I have found how to do it
File docFile = new File("C:\\test.rtf");
        File outFile = new File("C:\\test2.rtf");
        FileWriter writer=null;
        FileReader reader = null;
        try {
            reader = new FileReader(docFile);
             } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        javax.swing.text.rtf.RTFEditorKit kit = new RTFEditorKit();
       // Document doc = jEditorPane1.getDocument();
        Document doc =  kit.createDefaultDocument();
        try {
            kit.read(reader, doc, 0);
           String text=doc.getText(0,doc.getLength());
           text=text.replaceAll("&nom&","my name");
            //jEditorPane1.setText(doc.getText(0,doc.getLength()));
           jEditorPane1.setText(text);
           writer=new FileWriter(outFile);
           writer.write(text);
           writer.close();
           reader.close();
        } catch (BadLocationException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }

Similar Messages

  • Can I do a find and replace on .cfm files only and not search .html or .txt?

    Hi.  I'm using Dreamweaver CS4.  I would like to do a find and replace through my site with Dreamweaver but I only want it to search through .cfm files.  Currently it is searching through .html and .txt files along with .cfm.  Is there a way to do a find and replace on just .cfm files?
    - Tom

    You can't do it on just one type of file. However, you can do find and replace in selected files. Ctrl-click to select the targeted files in the Files panel, and then choose Selected Files in Site from the Find In drop-down.

  • Find and replace in RTF Template

    Hi,
    I'm using a if statement in my template, but i need to change a value within this statement. It's being used multiple times, therefor it would be easier to do a find and replace, is there a way to do a find and replace within the RTF template? Already openede it in Notepad++, but no luck
    Osman

    I don't think there is a way to find and replace all.. You can view all the code by using Field Browser -> Show All and then replace the code and update one by one from there..
    Thanks,
    Bipuser

  • Find and Replace text in files

    Is there a function that will find and replace a word in a few text files at once. E.G replace the word database1 with database2 without going into each script individually and doing and search and replace.

    Andrew, you are being so cruel, hardnuts indeed ;)
    I won't mention any names, but at least it's not as cruel as some people saying “You may read DBMS_STATS package specification, at least, to get details, if you're too lazy to read manuals.”
    Personally I prefer to use a development tool (TOAD, Pl/Sql Developer) instead of a Text type editor.

  • Find and replace characters in file names

    I need to transfer much of my user folder (home) to a non-mac computer. My problem is that I have become too used to the generous file name allowances on the Mac. Many of my files have characters such as "*" "!" "?" and "|". I know these are problems because they are often wild cards (except the pipe). Is there a way that I can do a find and replace for these characters?
    For example, search for all files with an "*" and replace the "*" in the file name with an "@" or a letter? I don't mind having to use the terminal for this (I suspect it will be easier).
    Is this possible? Does anyone have any suggestions?
    Thank you in advance for any help you may be able to provide.
      Mac OS X (10.4.8)  

    Yep.
    "A Better Finder Rename" is great for batch file renaming.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11366
    Renamer4mac may be all you need.
    Best check out VersionTracker. In fact everybody should have this site bookmarked and visited daily.
    http://www.versiontracker.com/macosx/

  • Find and replace string in file

    hi,
    i need to find and replace text (string) data in about 100+ files, i've decided to write a small java program to do it but i'm stuck on how to replace.
    here is what i'm heading towards:
    class ReplaceString {
      BufferedReader in;
      BufferedReader os;
      public static void main(String args[]) {
        ReplaceString obj = new ReplaceString();
        obj.replace();
       void replace() {
         try {
           in = new BufferedReader(new FileReader("a.txt");
           os = new BufferdWriter(new FileWriter("a.txt");
           //  read until end of file
           String currentLine = new String();
           while((currenLine=is.readLine()) != null) {
             //  if matching text then replace????
             if(currentLine.equals("Version 001") {
                // how to now replace the Version 001 with Version 002???
         }catch(IOException e) {
            System.out.println(e);
            in.close();
            os.close();
         in.close();
         os.close();
    }the above code i just typed so there might be errors, but looks ok to me, is there any way once i find the string i want to replace, to replace the string with another string. basically i want to replace all occurrences of the text "Version 001" with "Version 002"
    Thank you.

    Is it always true, as in your example, that the replacement is the same length as the existing string? If so, this one's easy.
    Is it also true that you don't need to worry about 16-bit chars? (Again, as in your example.) If you're using just ASCII characters, this gets easier still.
    1) Segregate the file I/O from the search/replace process.
    2) Main becomes:
    readFile();
    replace( "this", "that" );
    writeFile();Use a byte array buffer, defined in your main class. Fill it via the readFile() code. Use a RandomAccessFile, check its length() to allocate your byte array, then do a single read() to fill the buffer.
    A brute force search will certainly work: scan for the first search character, then check the rest for a match, replace if you've got a match and continue scanning. Alternative if your file's aren't too big: create a String from the byte array:
    // buffer is a byte array
    String s = new String( buffer );And use the String.replaceAll() to do the search/replace. Recover the buffer with:
    buffer = string.getBytes();A single write() and close() should handle the remaining work.

  • Find and replace with multiple files and with a watch folder

    I am trying to create a watch folder that uses red_menace script to:
    1. Have a folder that receives multiple xml files that run the script one by one.
    2. then move the files to an output folder.
    I tried modifying the set TheFIle to choose file -- the original text file to:
    with multiple selections allowed
    But that doesn't seem to work. I know i'm missing a step. Any help is much appreciated!
    Thanks!
    The way i'd like to setup things is having an input folder on the desktop (or just have the application on the desktop and I can drag the files onto it), and let it do it's thing. Once it's done have it export the xml files into an output folder.
    Here's what i got so far:
    on open
    set TheFIle to choose file -- the original text file
    set TheFolder to ("Macintosh HD:Users:user1:Desktop:out") -- the folder for the output file
    set TheName to (GetUniqueName for TheFIle from TheFolder) -- the name for the output file
    set TheText to read TheFIle -- get the text to edit
    set Originals to {"KPCALDATE", "KPCALEVENT", "KPCALDAY", "KPCALBODY", "obituaries name", "" & return & "</cstyle></pstyle>" & return & "<pstyle name=\"obituaries text\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>", " .com", " .net", " .org", " .edu", "www .", "www. ", "Ho- nolulu", "<pstyle name=\"kicker 12\"><cstyle allcaps=\"1\">fashion news</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "<component name=\"Headline 1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline 1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 36\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>-", "-", "
    Per serving:", "<pstyle name=\"Titlebar - mini, red\"><cstyle allcaps=\"1\">NATION & World </cstyle><cstyle allcaps=\"1\">Report</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "</cstyle></pstyle>"} -- the terms that can be replaced
    set Replacements to {"subhed", "subhed", "subhed", "Normal", "obituaries text", ", ", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>
    ", ".com", ".net", ".org", ".edu", "www.", "www.", "Honolulu", "", "<component name=\"Headline1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 27\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>—", " —", "
    Per serving:", "","" & return & "</cstyle></pstyle>"} -- the replacement terms
    repeat with AnItem from 1 to count Originals
    set TheText to (replaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
    end repeat
    try -- write a new output file
    tell application "Finder" to make new file at TheFolder with properties {name:TheName}
    set OpenFile to open for access (result as alias) with write permission
    write TheText to OpenFile starting at eof
    close access OpenFile
    on error errmess
    try
    log errmess
    close access OpenFile
    end try
    end try
    end open
    to GetUniqueName for SomeFile from SomeFolder
    check if SomeFile exists in SomeFolder, creating a new unique name if needed
    parameters - SomeFile [mixed]: a source file path
    SomeFolder [mixed]: a folder to check
    returns [text]: a unique file name and extension
    set {Counter, Divider} to {"00", "_"}
    -- get the name and extension
    set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
    if TheExtension is missing value then set TheExtension to ""
    set TheName to text 1 thru -((count TheExtension) + 2) of TheName
    set NewName to TheName & "." & TheExtension
    tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
    repeat while it contains NewName
    set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
    set NewName to TheName & Divider & Counter & "." & TheExtension
    end repeat
    end tell
    return NewName
    end GetUniqueName
    to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item edit (note that a return is used between each edit item)
    for each of the items in SomeItems, a line containing it's text is placed in the edit box
    the number of items returned are padded or truncated to match the number of items in SomeItems
    parameters - SomeItems [list]: a list of text items to edit
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the edited items, or {} if error
    set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
    if TheCount is less than 1 then return {} -- error
    if ThePrompt is in {true, false} then -- "with" or "without" Prompt
    if ThePrompt then
    set ThePrompt to "Edit the following items:" & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the given prompt a little
    set ThePrompt to ThePrompt & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
    set TheTitle to "Multiple Edit Dialog" -- default
    else
    set TheTitle to ""
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
    set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end EditItems
    to replaceText of SomeText from OldItem to NewItem
    replace all occurances of OldItem with NewItem
    parameters - SomeText [text]: the text containing the item(s) to change
    OldItem [text]: the item to be replaced
    NewItem [text]: the item to replace with
    returns [text]: the text with the item(s) replaced
    set SomeText to SomeText as Unicode text -- TID's are case insensitive with Unicode text
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
    set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
    set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
    return SomeText
    end replaceText
    Message was edited by: gamebreakers

    When you use the open or adding folder items to handlers, you need to add the parameters for the file items passed to them.
    I'll go ahead and post the applet/droplet version of my original script from the previous topic for reference:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    -- search and replace multiple items applet/droplet/folder action
    -- the terms to replace - edit as needed
    property EditableItems : {¬
    "one", ¬
    "two", ¬
    "three", ¬
    "four", ¬
    "five", ¬
    "six", ¬
    "seven", ¬
    "eight", ¬
    "nine", ¬
    "ten", ¬
    "eleven", ¬
    "twelve", ¬
    "thirteen", ¬
    "fourteen", ¬
    "fifteen", ¬
    "sixteen", ¬
    "seventeen", ¬
    "eighteen", ¬
    "nineteen", ¬
    "twenty"}
    -- the folder for the output file(s) - change as needed
    property TheFolder : (path to desktop)
    property LastEditItems : EditableItems
    on run
    the applet/droplet was double-clicked
    open (choose file with multiple selections allowed)
    end run
    on open TheItems
    items were dropped onto the applet/droplet
    parameters - TheItems [list]: a list of the items (aliases) dropped
    returns nothing
    repeat with AnItem in TheItems
    ReplaceMultipleItems from AnItem
    end repeat
    end open
    on adding folder items to this_folder after receiving these_items
    folder action - items were added to a folder
    parameters - this_folder [alias]: the folder added to
    these_items [list]: a list if items (aliases) added
    returns nothing
    repeat with AnItem in these_items
    ReplaceMultipleItems from AnItem
    end repeat
    end adding folder items to
    to ReplaceMultipleItems from SomeFile
    replace multiple text items in SomeFile
    parameters - SomeFile [alias]: the file to replace items in
    returns nothing
    set TheName to (GetUniqueName for SomeFile from TheFolder) -- the name for the output file
    set TheText to read SomeFile -- get the text to edit
    set Originals to (choose from list EditableItems default items LastEditItems with prompt "Select the terms to replace:" with multiple selections allowed) -- the specific terms to replace
    set LastEditItems to Originals
    set Replacements to (EditItems of Originals with Title given Prompt:"Edit the following replacement terms:") -- the replacement terms
    repeat with AnItem from 1 to count Originals
    set TheText to (ReplaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
    end repeat
    try -- write a new output file
    tell application "Finder" to make new file at TheFolder with properties {name:TheName}
    set OpenFile to open for access (result as alias) with write permission
    write TheText to OpenFile starting at eof
    close access OpenFile
    on error errmess
    try
    log errmess
    close access OpenFile
    end try
    end try
    end ReplaceMultipleItems
    to GetUniqueName for SomeFile from SomeFolder
    check if SomeFile exists in SomeFolder, creating a new unique name if needed
    parameters - SomeFile [mixed]: a source file path
    SomeFolder [mixed]: a folder to check
    returns [text]: a unique file name and extension
    set {Counter, Divider} to {"00", "_"}
    -- get the name and extension
    set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set {NewName, TheExtension} to {TheName, (ChangeCase of TheExtension to "upper")}
    set TheName to text 1 thru -((count TheExtension) + 1) of TheName
    tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
    repeat while it contains NewName
    set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
    set NewName to TheName & Divider & Counter & TheExtension
    end repeat
    end tell
    return NewName
    end GetUniqueName
    to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item edit (note that a return is used between each edit item)
      for each of the items in SomeItems, a line containing it's text is placed in the edit box
        the number of items returned are padded or truncated to match the number of items in SomeItems
    parameters - SomeItems [list]: a list of text items to edit
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the edited items, or {} if error
    set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
    if TheCount is less than 1 then return {} -- error
    if ThePrompt is in {true, false} then -- "with" or "without" Prompt
    if ThePrompt then
    set ThePrompt to "Edit the following items:" & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the given prompt a little
    set ThePrompt to ThePrompt & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
    set TheTitle to "Multiple Edit Dialog" -- default
    else
    set TheTitle to ""
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
    set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end EditItems
    to ReplaceText of SomeText from OldItem to NewItem
    replace all occurances of OldItem with NewItem
    parameters - SomeText [text]: the text containing the item(s) to change
    OldItem [text]: the item to be replaced
    NewItem [text]: the item to replace with
    returns [text]: the text with the item(s) replaced
    set SomeText to SomeText as text
    if SomeText contains OldItem then
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
    try
    set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
    set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
    on error ErrorMessage number ErrorNumber -- oops
    set AppleScript's text item delimiters to TempTID
    error ErrorMessage number ErrorNumber
    end try
    end if
    return SomeText
    end ReplaceText
    to ChangeCase of SomeText to CaseType
    changes the case or capitalization of SomeText to the specified CaseType using Python
    parameters - SomeText [text]: the text to change
    CaseType [text]: the type of case desired:
    "upper" = all uppercase text
    "lower" = all lowercase text
    "title" = uppercase character at start of each word, otherwise lowercase
    "capitalize" = capitalize the first character of the text, otherwise lowercase
    returns [text]: the changed text 
    set SomeText to SomeText as text
    if CaseType is not in {"upper", "lower", "title", "capitalize"} then return SomeText
    return (do shell script "/usr/bin/python -c \"import sys; print unicode(sys.argv[1], 'utf8')." & CaseType & "().encode('utf8')\" " & quoted form of SomeText)
    end ChangeCase
    </pre>
    Edit: how does the choose from list dialog handle those big strings? I'm guessing not very well - is that why you avoided using them?
    Message was edited by: red_menace

  • In Edge Code can i do a find and replace?

    In Edge Code can i do a find and replace on multiple lines of code or just a single line?

    You can't do it on just one type of file. However, you can do find and replace in selected files. Ctrl-click to select the targeted files in the Files panel, and then choose Selected Files in Site from the Find In drop-down.

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

  • Find and replace in files does not refresh when changes are made

    Using RH10, I search for a term with the Find and Replace Options pod. I use the Find Results list as a reference only, and open each file from the Topic List. I do this instead of opening the topics from the Find Results tab because I want to see the WYSIWYG changes. Anyway, I make my edits and delete the search term from each topic. Then, to make sure I have done all the work, I run the search again. I expect to see no or at least fewer matches than before, but I still get some or all of the same results as before, even though I double-check the Design and HTML views of the topics and even check the source of a topic separately in Notepad, all indicating that the search term is gone from the topic.
    There is some ridiculous lingering or echo going on. I make sure to select Look in: <Current Project>, and the paths of all the Find Results files are fine. How do you refresh the search so that this echo doesn't occur?
    Also, I close the Find and Replace Options pod, reopen it and start the search again, and the same results are there.
    Message was edited by: DMilkes

    Hi there
    To avoid the message about the file being modified, close all topics in the editor before commencing with any find and replace operations. The message is produced because you have the aforementioned topics open in the editor.
    As you mention "Find and replace in files", I'm guessing you are referring to version 8. I just opened version 8 and performed a find and replace to confirm. There is a button allowing you to clear all.
    On the clicking and dragging to create a link, it's never worked that way. You simply cannot drag from the Topic List pod to do it. But you can from the Project Manager pod. Perhaps you should consider submitting a Wish Form to ask for the ability to click and drag from the Topic List pod to create links.
    As far as rearranging your topics into different folders, as long as you do it from inside RoboHelp you shouldn't be destroying any links. RoboHelp will update references for you as you move things around. The only issue is if you are automatically creating your TOC structure based on the project structure. But usually that's a one time shot. From there forward you just manage things using the TOC editor.
    Hopefully this helps... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

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

  • Is there a way to find and replace prices in an Indesign document from a CSV file?

    Is there a way to find and replace prices in an Indesign document from a CSV file. Currenty I have a catalog with codes and prices in tables. I need to find a way to look up the code (and new price) in the CSV file and overwrite the price in the current table with the new price. Does anyone know of a script to run this quickly?

    Hi,
    Try this
    1) with all the images showing, got to Find -> By caption or Note
    2) enter the caption you are looking for Image Description and click on OK
    It should display all the ones with that caption
    3) select a few images as a test
    4) go to Edit -> Add caption to selected items
    5) if you want to blank out the captions just check the box to replace the caption and click on ok
    6) You will need to confirm the blank captions
    You could use a similar procedure to change the caption to something else.
    Good luck
    Brian

  • Find and Replace Japanese characters in pdf file on iPhone

    Hi eveybody !
    I want to find and replace Japanese characters in pdf on iPhone.
    I using zlib to deflate stream - endstream block and extract text.It's work fine with latin-text.
    But when i work with japanese characters , I don't know how to do it ?
    I decode a sample japanese pdf file, and I know that each Japanese characters are performances as hex string : "<01b7><0e230a23>..."
    But i don't know how to convert Japanese characters to the hex string like that.
    Can evrybody help me?
    Thanks!

    Searching is the same process as extracting - since it's about turning page content into something understandable.  So that still remains what you need to learn/understand - of course, referring back to all the previous sections about font formats, etc.
    Replacing in PDF is EXTREMELY DIFFICULT for two reasons - subset fonts and explicit glyph positioning.  Have you determine (conceptually, if nothing else) how you plan to addresses these two issues?
    PDF doesn't do UTF8 for page content - so don't worry about that.

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

  • How to prevent find and replace from finding linked files?

    I have a bunch of ASP pages that I need to update in the same manner with Find and Replace. In order to do this, I open all the files, use Find and Replace, and choose to Replace All in the Source Code of Open Documents.
    Pretty straightforward, right? Except, if I have any include file statements, such as this:
    <!--#include file=" yadda yadda"-->
    DW opens these files on its own, and updates THEM as well.
    This is a very frustrating behavior. I have been through the Preferences several times and I'm just not seeing any way to turn this off.
    I have tried Googling this problem, and have seen absolutely no mention of it.
    Does anyone know if this annoyance can be disabled?
    Thanks.

    I would try selecting the specific files in the Files tab, then using "Selected Files in Site" and see what happens.
    I think DW considers related files to be "open" (since you can edit them from within the main file they are related to) when that option is turned on and the files they're related to are open.

Maybe you are looking for

  • Can someone tell me how to sync my ipod on my new computer i have just authorised. i hate this

    Can someone tell me how i sync my ipod on my new computer. i have authorised the computer but i can not find where to sync it. i thought Apple was meant to be easy

  • Mac Mini Late 2014 crashing nightly

    Several nights now my new mac mini (Late 2014), 10.10 has crashed and shutdown. It cold boots with power button press. Logs show it might be trouble with sleep, but posting this since long thread on these troubles with Yosemite is for Mac Mini 2012.

  • Display oddity- What in the world?

    A grand total of two times, the screen on my MacBook Pro (13' Mid 2010) has demonstrated the symptom in the picture below.  Both times, in conjunction with Mail.app being in use and the "frontmost" application.  Quitting Mail would remove part of the

  • Windows won't recognize Nano connecting.

    My genius friend decided to plug my iPod into his xbox 360, and now windows won't recognize my iPod Nano, and it won't turn on, and I don't know what to do.

  • Planning ADM driver with Financial Reporting

    We are receiving a "Error: Error creating objectjava.lang.ClassNotFoundException" when trying to create a Planning Detail db connection through workspace and an "error setting CSS Support Information Driver" error when trying to do the same thing thr