i have a psd file named myDocument.psd
i want to change few text values when i click on button.
i need to change a 10 texts value
and then i want to save it in a new file (png file)
thanks for the helpers
Code: Select all
<button onclick="changeTextByLayerName()">Click me</button>
<script>
//get the active document
function changeTextByLayerName(layerName,newText){
var fileRef = new File("\myDocument.psd");
app.open( fileRef );
var layer = doc.layers.getByName('9542857');
if(layer.kind == LayerKind.TEXT) layer.textItem.contents = '123';
var filePath = activeDocument.fullName.path;
var pngFile = File(fileRef + "/" + "myname.png");
pngSaveOptions = new PNGSaveOptions();
doc.saveAs(pngFile, pngSaveOptions, true, Extension.LOWERCASE);
doc.close(SaveOptions.DONOTSAVECHANGES);
// close the original layered document without saving
}
</script>