Skip to main content
Participant
January 19, 2023
Question

layer.textItem is undefined

  • January 19, 2023
  • 3 replies
  • 541 views

Hello everyone!

I've try to create an UXP plugin by javascript on Photoshop v23.5. 

But when I get text content of layer with: layer.textItem, I've got "undefined".

Please help!

 

layer = require("photoshop").app.activeDocument.layers.getByName("text1");
console.log(layer.kind); # => "text"
console.log(layer.textItem); # => undefined 

 

This topic has been closed for replies.

3 replies

c.pfaffenbichler
Community Expert
Community Expert
July 21, 2023

textItem seems to work perfectly fine in Photoshop CC 2019 (the oldest running version I have access to here). 

And in Photoshop 2023 naturally, too. 

Participant
July 21, 2023

What you are referring to is CEP js scripting. CEP / Extendscript does have support for layer.textItem.
@Ba Nguyen 's query was about developing a plugin for Photoshop v23.5 using UXP.
Docs Reference

 

 

c.pfaffenbichler
Community Expert
Community Expert
July 21, 2023

Thanks; sorry, I had misunderstood the OP. 

Participant
July 20, 2023

I was facing the same issue.
Found out that access to layer.textItem is supported from v24.2
reference: Layer (adobe.com) 

c.pfaffenbichler
Community Expert
Community Expert
July 21, 2023

Could someone just post a meaningful screenshot? 

 

quoteFound out that access to layer.textItem is supported from v24.2
reference: Layer (adobe.com) 

The oldest JavaScript Reference I found is for CS4 and the property textItem existed back then. 

 

c.pfaffenbichler
Community Expert
Community Expert
January 19, 2023

Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible? 

 

If you mean the text itself you need layer.textItem.contents