Find and replace text in multiple Photoshop files?

前端 未结 1 814
梦毁少年i
梦毁少年i 2020-12-20 20:56

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 w

相关标签:
1条回答
  • 2020-12-20 21:14

    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)
    }
    
    0 讨论(0)
提交回复
热议问题