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.

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.

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • Find and Replace text string in HTML

    Opps... I hope this forum is not just for Outlook. My Html files reside on my hard-drive. I am looking for VBA code to open specified file names ####File.html and then find and replace text strings within the html for example "####Name" replaced
    with "YYYYY"
    I drive the "####File.html" names and the find and replace text strings from an Excel sheet. I am an artist and this Sub would give me time to paint instead of find and replace text. Thank you!
    [email protected]

    Hello Phil,
    The current forum is for developers and Outlook related programming questions. That's why I'd suggest hiring anybody for developing the code for you. You may find freelancers, for example. Try googling for any freelance-related web sites and asking such
    questions there.
    If you decide to develop an Outlook macro on your own, the
    Getting Started with VBA in Outlook 2010 article is a good place to start from.

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

  • How do I find and replace text in PHP files?

    How can I in CS3 make sitewide changes to the text in PHP pages without changing variable names etc that have the same name?
    For example if I have an installation of a PHP forum and I want to change every instance of the word 'forum' to 'message board'...
    If I used the 'inside tag' search with " as the tag, then if "" contained a variable called 'forum' it would also be changed and therefore corrupt the code....
    Is there a simple way around this?
    Thanks!
    I'm using CS3 on Windows Vista.

    It looks like you're trying to find and replace source code, so you may be able to look at the various places that are looked at when finding and uncheck the ones that don't apply.
    But, if it's all source code then that won't help.  One thing that may work is to expand the search option - for example if the work "forum" that you're wanting to change it preceded by another word, or character or something that sets it apart, then do you find on that. You can expand that search phrase as far out in either direction that you need to to make it different, if of course that is practical in your situation.
    The only other way I can think of is to somehow create an exception rule, but I'm not sure if that's possible or how to do it.

  • [Forum FAQ] How to find and replace text strings in the shapes in Excel using Windows PowerShell

    Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
    shapes in Excel Object.
    Since the Excel.Application
    is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
    interact with Excel document.
    The figure below is an excel file:
    Figure 1.
    You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
    $text = “text1”,”text2”,”text3”,”text3”
    $Excel 
    = New-Object -ComObject Excel.Application
    $Excel.visible = $true
    $Workbook 
    = $Excel.workbooks.open("d:\shape.xlsx")      
    #Open the excel file
    $Worksheet 
    = $Workbook.Worksheets.Item("shapes")       
    #Open the worksheet named "shapes"
    $shape = $Worksheet.Shapes      
    # Get all the shapes
    $i=0      
    # This number is used to replace the text in sequence as the variable “$text”
    Foreach ($sh in $shape){
    $sh.TextFrame.Characters().text  
    # Get the textbox in the shape
    $sh.TextFrame.Characters().text = 
    $text[$i++]       
    #Change the value of the textbox in the shape one by one
    $WorkBook.Save()              
    #Save workbook in excel
    $WorkBook.Close()             
    #Close workbook in excel
    [void]$excel.quit()           
    #Quit Excel
    Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
    Besides, we can also find the documents about these methods and properties in MSDN:
    Workbook.Worksheets Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
    Worksheet.Shapes Property:
    http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
    Shape.TextFrame Property:
    http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
    TextFrame.Characters Method (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
    Characters.Text Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
    After running the script above, we can see the changes in the figure below:
    Figure 2.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thank you for the information, but does this thread really need to be stuck to the top of the forum?
    If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
    EDIT: I see this is no longer stuck to the top of the forum, thank you.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to find and replace text in Excel with Automator

    I am new to Automator. And I would like some help how I can create a service that will allow me to find and replace certain text in Excel. I noticed that there is an action to do this for Word documents, but not for Excel document.
    Any suggestions how I can do this?
    Thanks so much for your help.

    Easiest way to do it is the following:
    - Open the PDF file in Acrobat.
    - Go to Tools - Forms - More Form Options - Export Data.
    - Save the form data as an XML file somewhere on your system.
    - Open XML the file in a plain-text editor (I recommend Notepad++).
    - Let's say you want to replace all the years in the dates from "2013" to "2014". Do a global Search&Replace of "2013-" to "2014-" (I added the dash just to make sure that only date fields are edited).
    - Save the XML file (maybe under a new name).
    - Go back to the PDF file, and now go to Tools - Forms - More Form Options - Import Data.
    - Select the edited XML file and import it.
    - Done!

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

  • Find and Replace Text box

    I have a document with roughly 50 pages. At the bottom of each page is a text box about with my address going across. I moved so I need to update the address, only problem is the address is longer so after using find and replace I would have to go to each text box and re-size. IS there a way to replace them all with new one or is there some way to add footer and I have been doing it wrong all along?
    Thanks for your time and help.

    This is what master pages are for.
    Bob

  • Find and replace help needed, multiple variables

    Hi everyone,
    Im trying to find all urls in my code that start in a particular way but have a number variable at the end, see examples below
    <a href="/example/examplefolder/enquiry.asp?pid=123">
    <a href="/example/examplefolder/enquiry.asp?pid=485">
    <a href="/example/examplefolder/enquiry.asp?pid=284">
    and replace them with one url, see example below
    <a href="/example/examplefolder/default.asp">
    How can I use Dreamweaver find and replace to achieve this across my whole website?
    So far I only know how to find one thing and replace with another, rather than finding variables and replacing them with one thing.
    Thanks for your help with this!

    In the Find field of the Find and Replace dialog box, enter this:
    (href\s*=\s*\"\/example\/examplefolder\/enquiry\.asp)\?pid=\d+(\")
    In the Replace field, enter this:
    $1$2
    Select the "Use regular expression" checkbox.
    Explanation:
    The two sets of parentheses are capturing groups, which capture the actual values as $1 and $2.
    The \s* matches zero or more spaces.
    \" matches a double quote.
    \/ matches a forward slash.
    \? matches a question mark
    \d+ matches one or more numbers.
    I have written a two-part tutorial on using regular expressions, which can be found here: http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt1.html.
    Message was edited by: David_Powers (adding explanation of double quote).

  • [SOLVED] Find and replace quotes with underscores in file names

    I was looking to replace all of the quotes in file names in a directory with underscores.  I seem to be having a problem doing so, though.  Running the find command:
    find . -name '*[\`\'\"]*' -exec sh -c "mv -i '$0' '${0//[\`\'\"]/_}'" {} \;
    I get a > inviting me to continue the command.  What am I doing wrong?
    Last edited by gogi-goji (2010-01-03 02:19:13)

    @lolilolicon: yeah the -exec part does give another level of quotes, so you can run into trouble with scripts inside -exec.
    I didn't know you could give {} as an argument after sh -c and $0, that solves the problem of not knowing which quotes to use around it in the -exec part.
    $ find -mindepth 1 -exec sh -c 'mv -v --backup=t "$0" "$(echo "$0" | sed s/[\\x27\"\`]/___/g)"' {} \;
    mv: `./a b' and `./a b' are the same file
    `./\'' -> `./___'
    `./\'"\'' -> `./_________'
    mv: `./$0' and `./$0' are the same file
    mv: `./a' and `./a' are the same file
    mv: `./$(echo crash)' and `./$(echo crash)' are the same file
    `./"' -> `./___' (backup: `./___.~1~')
    `./\'\'\'' -> `./_________' (backup: `./_________.~1~')
    Or with the other substitution method, it doesn't interpret \x27 (you could use $(echo -e \\x27) or you have to use ...'\\\''...
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//['\\\''\"\`]/___}"' {} \;
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//[$(echo -e \\x27)\"\`]/___}"' {} \;
    mv -v --backup=t ./a b ./a b
    mv -v --backup=t ./' ./___
    mv -v --backup=t ./___ ./___
    mv -v --backup=t ./'"' ./_________
    mv -v --backup=t ./$0 ./$0
    mv -v --backup=t ./___.~1~ ./___.~1~
    mv -v --backup=t ./a ./a
    mv -v --backup=t ./$(echo crash) ./$(echo crash)
    mv -v --backup=t ./_________ ./_________
    mv -v --backup=t ./" ./___
    mv -v --backup=t ./''' ./_________
    mv -v --backup=t ./_________.~1~ ./_________.~1~

  • Find and Replace text in several files

    Can automator do that?
    I made a website in iweb and as the ones of you that had already tried it must know, it is impossible to change the font format on the links, you have to hack the code manually, changing the .css files.
    I think a trick would be to get automator to replace the code automatically, to lock for a string of text inside a group of files and save it. I just don't know how to do it. Can anybody help?
    The most I have been able to do is to get automator to open all .css files within a folder, inlcuidng all subfolders and open them on textedit.

    I doubt anyone is going to download and look at your code. Please remember that anyone who helps you here is a volunteer, and so the onus is on you to make helping you as easy as possible to do. That means you must take the effort to pare your code down to the bare minimum that shows your problem and compiles, and then post this code here. If you do decide to do this, please use code tags by highlighting your code after pasting it, and then pressing the Code button just above the editor window.
    Good luck.

  • Find and Replace text and change font help needed.

    I am completely new to Scripting and I'm sure this is quite simple but I do not know where to start.
    I have a FM template that is populated with "raw" text from a database.
    Within the text are several characters (+, @, *, $, # and %).
    I need to replace these characters with symbols from a different font e.g.:
    Each instance of:
    "+" to be replaced with Wingdings 2 font - Lowercase t
    "@" to be replaced with Wingdings 2 font - Lowercase u
    "*"  to be replaced with Wingdings font - Uppercase E   etc.
    I would like to automate the process and believe a script would enable me to do this.
    I have tried looking on the forum, but can not find anything suitable to help me (or I'm looking in the wrong place).
    Any help would be greatly appreciated.
    Cheers
    Kev

    not really
    important is the Illustrator Text Object-model, which is not very easy to understand.
    And the Core JS String and regExp Objekts.
    Have a look at this:
    http://www.ogebab.de/home/skripte/text/replace
    The dialog is poor (because of compatibility) and it works simply on TextFrames.contents, i don't know if this is good i all cases.
    But i use it not very often so i don't want to rewrite it.
    Maybe it is a starting-point for you.
    But maybe it is more then you need.
    try this:
    //select a text
    var text = app.activeDocument.selection[0];
    var string = text.contents;
    string = string.replace(/ /g,"  ");
    text.contents= string;
    / /g is a regular expression
    .replace() is a method of the String Object
    both explained at
    https://developer.mozilla.org/en/JavaScript/Reference

  • Find and Replace Font Colors in Multiple Text Boxes

    Hello,
    I have Illustrator version 15
    I made many text boxes with multiple colors, red and black on each letter. I was wondering if there is a find and replace tool for multiple text boxes. I want to change the reds to black and the blacks to light grey. I tried clicking on change swatch color but it only worked for the letter I had selected, even with the global option selected. I then when to select -> Same -> Color Stroke but it just selected each text box on the page....Is there anyway to do this?
    Jordan

    Not exactly a find and replace but you can do it.
    Select the text frames yu want to change the colors using the shift key to click select the frames.
    Then go to Edit>Edit Color>Recolor Art
    You wll see a dialog with red and black bars along side two shorter bars click the shorter bars to select a New Color a color picker will appear you can use the swatches or the color mixer.
    There is a live preview /so you will see the change in case you want to pick a different gray, of course you can always go back to the recolor art dialog.
    I am afraid you manually have to select text frames with multiple colors in order to accomplish what you want but the method above I believe is the only want to change the colors.
    This video shows how the dialog works but pretend the one frame I did not select is another color.
    http://www.wadezimmerman.com/videos/RecolorText.mov

Maybe you are looking for