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

Unable to select a text range with scripting cep

Engaged ,
Jul 30, 2021 Jul 30, 2021

I'm attempting to change the type on a text range with code (CEP) and am unable to do so.

The following is a screen shot of the layers in this file.

Screen Shot 2021-07-30 at 6.25.23 PM.pngexpand image

 

I attempt to select and change the text range like so (I don't get passed the selecting part):

var iDoc = app.activeDocument;
                var custom1Only = iDoc.textFrames.getByName('Custom1Only');
                alert(custom1Only.contents);

                var custom1 = iDoc.textFrames.getByName('Custom1');
                alert(custom1.contents);

 

I then get the error for 'Custom1'. it says "Error: No such element"

Any idea why this is happening? Strangely enough Custom1Only is accessible.

TOPICS
Scripting
319
Translate
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 , Jul 31, 2021 Jul 31, 2021

OhmsG,

As @femkeblanco said, it may possible that the textframe content is "Custom1", but in real its name is empty. Try to give name to the textframe again and run your script.

Translate
Adobe
Community Expert ,
Jul 30, 2021 Jul 30, 2021

Hi @OhmsG, I made a file to match yours and ran your exact code. It worked fine for me—I got both alerts. Try setting up again in another document or post your actual test document and someone might be able to get to the bottom of it.

Translate
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
Guide ,
Jul 31, 2021 Jul 31, 2021

Is the textFrame definitely named? 

Translate
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 31, 2021 Jul 31, 2021
LATEST

OhmsG,

As @femkeblanco said, it may possible that the textframe content is "Custom1", but in real its name is empty. Try to give name to the textframe again and run your script.

Best regards
Translate
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