Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change bulk text across PSD multiple files within folders

Community Beginner ,
Jan 08, 2023 Jan 08, 2023

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! 

TOPICS
Actions and scripting , macOS
975
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 08, 2023 Jan 08, 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-p...

 

And here:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/find-and-replace-text-content-includi...

 

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 08, 2023 Jan 08, 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 😫

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 08, 2023 Jan 08, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 08, 2023 Jan 08, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 09, 2023 Jan 09, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 09, 2023 Jan 09, 2023

@Lumigraphics â€“ Ah formatting... Looks like I forgot about that! :]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 09, 2023 Jan 09, 2023
LATEST

Formatting is a huge PITA, frankly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines