• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

layer.textItem is undefined

New Here ,
Jan 18, 2023 Jan 18, 2023

Copy link to clipboard

Copied

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 

 

TOPICS
Actions and scripting , macOS , SDK , Windows

Views

371

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 18, 2023 Jan 18, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2023 Jul 20, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 21, 2023 Jul 21, 2023

Copy link to clipboard

Copied

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. 

Screenshot 2023-07-21 at 12.13.43.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 21, 2023 Jul 21, 2023

Copy link to clipboard

Copied

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. 

textItemScriptTest.gif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 21, 2023 Jul 21, 2023

Copy link to clipboard

Copied

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

MS31198329wywq_0-1689944908869.png

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 21, 2023 Jul 21, 2023

Copy link to clipboard

Copied

LATEST

Thanks; sorry, I had misunderstood the OP. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines