Skip to main content
Participant
January 9, 2023
Question

Change bulk text across PSD multiple files within folders

  • January 9, 2023
  • 3 replies
  • 1098 views

Heyoo, 

I regularly have between 4 and 6 documents i need to work across that need bulk text changes that range from single words to whole paragraphs (it doesnt sound like a lot but there is regularly 20-40 comments and i'll need to do the changes across all docs, so end up doing the same thing mulitple times). Is there a way i can search and change the text across all open psd files instead of one by one? I've looked in other posts but cant quite figure out what to do (never needed to use the script function before). 

Using PSD 2023 24.0.0 

 

Really want to be able to steamline this so i can spend more time on actual art than text changes! 

 

Thanks! 

This topic has been closed for replies.

3 replies

Legend
January 9, 2023

If that simple snippet works you are good. If you need to preserve formatting, I have some sample scripts on my Dropbox for replacing text.

https://www.dropbox.com/sh/mg817g9a9ymbasi/AADTmXUVxmFfM58bcyYE7yiwa?dl=0

Stephen Marsh
Community Expert
Community Expert
January 9, 2023

@Lumigraphics – Ah formatting... Looks like I forgot about that! :]

Legend
January 9, 2023

Formatting is a huge PITA, frankly.

Michael Bullo
Community Expert
Community Expert
January 9, 2023

Do you want to continue to exclusively use Photoshop for these designs? Is there any chance you would consider placing your Photoshop files into InDesign documents? If so, you will get access to a huge array of text editing and updating options.

Stephen Marsh
Community Expert
Community Expert
January 9, 2023

The following example uses a hard-coded regular expression to change the isolated word dog to Cat in all text layers in all open documents.

 

// Replace text Dog with Cat in all layers in all open docs.jsx

for (var i = 0; i < app.documents.length; i++) {
    app.activeDocument = app.documents[i];

    var doc = app.activeDocument;
    for (var j = 0; j < doc.layers.length; j++) {
        try {
            doc.activeLayer = doc.layers[j];
            // Find = Dog, Replace = Cat
            // g = global, i = case insensitive
            if (app.activeDocument.activeLayer.kind == LayerKind.TEXT) {
                doc.activeLayer.textItem.contents = doc.activeLayer.textItem.contents.replace(/\bDog\b/gi, 'Cat');
            }
        } catch (e) {}
    }
}

 

More here:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/javascript-find-and-replace-text-in-photoshop/m-p/10847173

 

And here:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/find-and-replace-text-content-including-non-visible-layers/m-p/10978369

 

Searching the forum or web will kick up more...

 

Participant
January 9, 2023

Thanks heaps for replying!!

Can you EILI5? i've got zero idea how to impliment it and i've been trying for a bit 😫

Stephen Marsh
Community Expert
Community Expert
January 9, 2023

Ok, I had to Google that...


Quickstart:

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

 

If these simple instructions are too abbreviated, you may need to read on...

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html