[英]I am a Photoshop scripting beginner. I want to ask everyone how to replace the text layer
I am a Photoshop scripting beginner.我是 Photoshop 脚本初学者。 I want to ask everyone how to replace the text layer in photoshop with Photoshop to read the contents of the external txt file.想请教大家如何用Photoshop替换photoshop中的文本图层读取外部txt文件的内容。 I am very annoyed.我很生气。
First load the contents of the external text-file:首先加载外部文本文件的内容:
var extText = new File("path/to/external.txt");
if( extText ) {
extText.open('r');
var content = "";
while(!extText.eof) contents += extText.readln() + "\n";
extText.close();
};
Then use that the contents to update your text-layer:然后使用内容来更新您的文本层:
var textLayer = app.activeDocument.artLayers.getByName("layer-name");
textLayer.textItem.contents = contents;
Hope this will help you feel less annoyed ;)希望这能帮助您减少烦恼;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.