简体   繁体   English

我是 Photoshop 脚本初学者。 想请教大家如何替换文字图层

[英]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.

相关问题 在Photoshop脚本中替换图层图像 - Replace Layer image in Photoshop scripting Photoshop 脚本 - 如何在一个历史状态下创建文本图层 - Photoshop scripting - how to create text layer in one history state 在 Photoshop 中使用脚本替换图层中的图像 - Replace image in a layer in Photoshop using scripting Photoshop脚本:更改文本图层的文本 - Photoshop scripting: changing text of a text layer 使用Adobe Photoshop中的JavaScript脚本,如何更改所选文本层的内容 - Using JavaScript scripting in Adobe Photoshop, how to change the contents of the selected text layer 如何使用 photoshop javascript 脚本聚焦另一个文档? - How do I focus another document with photoshop javascript scripting? 有人可以解释一下与 Js Callback function 有关的代码吗? 我对这段代码很困惑,可能是因为我是初学者。 问题是: - Can some please explained this code relating to Js Callback function? I am very confused with this code maybe cause I am a beginner. Questions are: 如何使用自动识别水平和垂直框架重命名图层 [Photoshop 脚本] - How to Rename Layer With Auto Identify Horizontal and Verticle Frame [Photoshop Scripting] Javascript 的 Photoshop 脚本:如何解锁部分锁定的图层? - Photoshop Scripting with Javascript: How to unlock a partially locked layer? 如何在 Photoshop 中将图层转换为智能对象? - How can I convert layer to smart object in Photoshop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM