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

Get content from Anchored text frame

Contributor ,
Oct 10, 2022 Oct 10, 2022

Hi friends,

Please help on this. 

How to get content in the Anchored text-frame from linked footnote element.

My Process: first i need to select footnote element and catch with Anchor text-frame contents.

 

karthikS_0-1665392858977.png

 

Kindly advice on this.

 

Thanks in Advance,

Karthik S

TOPICS
Scripting
589
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 , Oct 10, 2022 Oct 10, 2022

Hi @karthikS ,

if you get the footnote text you can access all text frames in that text and then get the contents or the formatted text inside the anchored text frame. In dummy code, variable myFootnote below should contain a footnote object, for the first text frame in the footnote text:

myFootnote.texts[0].textFrames[0].parentStory.contents

or all formatted text:

myFootnote.texts[0].textFrames[0].parentStory

 

Regards,
Uwe Laubender

( Adobe Community Expert )

 

Translate
Community Expert ,
Oct 10, 2022 Oct 10, 2022

Hi @karthikS, in cases like this, it is always helpful to attach a sample indesign document. It can be just one page with the footnote and anchored text frame. It will make it easier and quicker for people to help. - Mark

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
Contributor ,
Oct 10, 2022 Oct 10, 2022

Hi Mark,

Thanks! i have attached the indd file for your reference. Kindly check and advice on this.

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 ,
Oct 10, 2022 Oct 10, 2022
LATEST

Hi @karthikS, here is my approach. @Laubender your way is very simple. Maybe I am overthinking it?

- Mark

 

var doc = app.activeDocument;

// find all anchors
app.findGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.findWhat = '~a';
var found = doc.findGrep();

// discard any anchors without the xml tag 'footnote'
for (var i = found.length - 1; i >= 0; i--)
    if (found[i].associatedXMLElements[0].markupTag.name != 'footnote')
        found.splice(i, 1);

// get the anchored text frames contents
var anchoredContents = [];
for (var i = 0; i < found.length; i++)
    anchoredContents.push(found[i].textFrames[0].contents);

// now you have each contents
alert(anchoredContents[0]);
alert(anchoredContents[1]);

 

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 ,
Oct 10, 2022 Oct 10, 2022

Hi @karthikS ,

if you get the footnote text you can access all text frames in that text and then get the contents or the formatted text inside the anchored text frame. In dummy code, variable myFootnote below should contain a footnote object, for the first text frame in the footnote text:

myFootnote.texts[0].textFrames[0].parentStory.contents

or all formatted text:

myFootnote.texts[0].textFrames[0].parentStory

 

Regards,
Uwe Laubender

( Adobe Community Expert )

 

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
Contributor ,
Oct 10, 2022 Oct 10, 2022

Hi Uwe,

Thanks lot! this is working fine.

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