Skip to main content
Participating Frequently
April 3, 2025
Question

Can't find textframe using doc.textFrames.itemByName("myTextFrame");

  • April 3, 2025
  • 1 reply
  • 1170 views

In a document i have inserted a textframe and added myTextFrame into its Script Label.

When trying to get it by js using doc.textFrames.itemByName("myTextFrame"); is says the object is invalid.

When trying doc.textFrames[0] i get a textframe with label myTextFrame.

Having same issues with rectangels -> var rect = doc.rectangles.itemByName(rectName);

 

1 reply

TᴀW
Brainiac
April 3, 2025

If I'm not mistaken, itemByName will get a frame according to its name in the Layers panel, not its script label.

Participating Frequently
April 3, 2025

Were usually placing ICML files, but would like to test placing using xml and js script.
How do i parse formatted text into a textframe.
Our current ICML is <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/D-OS" SpanColumnType="SpanColumns"><CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/bold"><Content>Nyt multiredskab sikrer ensartede græsmarker</Content><Br /></CharacterStyleRange></ParagraphStyleRange>

But we can send the content as HTML or anything else

Participating Frequently
April 3, 2025
quote

[...] 
But we can send the content as HTML or anything else


By @Keld294028034yyk

 

If you generate text contents yourself - take a look at InDesign Tagged Text.

 


I would take a look into that