I am trying to write a script that will update the value of a text layer in Photoshop.
I have a layer stored in a variable myLayer
which I log out so I know it is an ArtLayer
with a type of LayerKind.TEXT
and has a textItem
object associated that has a string value in place. All as I would expect.
The documentation says that textItem.contents
is read-write so I thought myLayer.textItem.contents = "Hello World"
should update the value but when I try this I get General Photoshop Error occurred. This functionality might not be available in this version of Photoshop
.
Can anyone advise on what I’m missing?
I am using Photoshop CC 2014 and the CC 2014 Javascript Reference
Thankyou in advance for you help 🙂
2
Answers
Its hard to see whats going wrong when there is no code example. This works for me.
Tested in PS CC 2014 Mac OSX
This works in CS2: (Assuming the active layer (mylayer) is a text layer)