查找并替换多个Photoshop文件中的文本? [英] Find and replace text in multiple Photoshop files?

查看:92
本文介绍了查找并替换多个Photoshop文件中的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们说我有六个Photoshop文件:1.psd,2.psd,...,6.psd。所有这些文件在每个文档中的随机文本层中都包含单词LoremIpsum。有没有办法可以在所有文件中搜索LoremIpsum并将其替换为Dolor Sit Amet,一气呵成?

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?

我尝试过查找和替换软件(包括强大的工具,如Power Grep),但它们不能与psd文件一起使用......也许Photoshop变量?但是,它们只能同时处理一个文档...

I have tried finding and replacing software (including powerful tools like Power Grep) but they do not work with psd files... Maybe Photoshop variables? However, they only work for one document at once...

谢谢!

推荐答案

使用类似下面的脚本。有关详细信息,请在Photoshop安装目录中查看Photoshop JavaScript Reference pdf。

Use something like the script below. For more info check out your Photoshop JavaScript Reference pdf in your Photoshop install directory.

var dir = new Folder('/c/temp')
var files = dir.getFiles("*.psd");

for (var i = 0; i < files.length; i++) {
    var doc = app.open(files[i]);

    for (var j= 0; j < doc.artLayers.length; j++) {
        var lyr = doc.artLayers[j];

        if (lyr.kind == LayerKind.TEXT) {
            var lyr = doc.artLayers[j];
            lyr.textItem.contents = lyr.textItem.contents.replace("search","replace"); 
        }
     }

    doc.close(SaveOptions.SAVECHANGES)
}

这篇关于查找并替换多个Photoshop文件中的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆