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

Calling an object by name

Explorer ,
Jun 11, 2017 Jun 11, 2017

Copy link to clipboard

Copied

I tried to rename a text object like "text1" in layers palette,

save document,

and then I try to execute the script:

var myDoc = app.activeDocument;

var textFrame = myDoc['text1'];

textFrame.contents = "111111111";


I get an error

Безымянный.png

How to fix it?

TOPICS
Scripting

Views

247

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

correct answers 1 Correct answer

Community Expert , Jun 11, 2017 Jun 11, 2017

Hi andyf65867865​,

untestet, but you can try

var myDoc = app.activeDocument;

var textFrame = myDoc.pageItems.getByName('text1');

textFrame.contents = "111111111";

Have fun

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 11, 2017 Jun 11, 2017

Copy link to clipboard

Copied

LATEST

Hi andyf65867865​,

untestet, but you can try

var myDoc = app.activeDocument;

var textFrame = myDoc.pageItems.getByName('text1');

textFrame.contents = "111111111";

Have fun

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