Desperate for some scripting help for Photoshop (v 23.4.1, Windows 10).
I have a text layer that I want to be able to resize and reposition. I've searched through countless posts, tried various examples, but can't seem to quite get it. Hoping someone can help. Here is the manual way of doing it:
1. Start with a word with certain font settings. The type layer size is set to 1920 x 540, position 0,0, all in pixels.
2. Update the text to a new word. The width has changed (to 1129.79), and the x position has changed (409.85).
3. Update the transform values back to 1920 pixels for width and 0 pixel for x position:
This is what I would like to accomplish via scripting. The replacement of whatever word exists in the layer, and then resizing so that it is 1920 width, and back at 0 position for x. The text will stretch accordingly, while maintaining the 1920 width and centered in the layer, which is the exact result I want.
Basic script I have to start to update the layer is:
var doc = app.activeDocument; var wordLayer = doc.layers.getByName('WORD LAYER'); wordLayer.kind = LayerKind.TEXT; var wordLayerText = wordLayer.textItem; var wordText = "cat"; wordLayerText.contents = wordText;
All attempts at adding the transformation methods have failed, especially when trying to do it via pixel values.