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

Get the parent TextFrame of a marker using ExtendScript (Unstructured)

Explorer ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Hi,

I am a newbie in ExtendScript. In my document, I have a couple of TextFrames which contain hyperText markers. Using ExtendScript I can get all the HyperText markers. Now I want to get the parent of each marker via script. But I couldn't find anything in the documentation.

Any help or suggestion would be appreciated.

Sanam  

TOPICS
Scripting

Views

94

Likes

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 , Aug 03, 2022 Aug 03, 2022

A marker will have a TextLoc property and you can use this to get the parent TextFrame. Something like this:

var textFrame;

// Assuming marker is your Marker object and doc is your Doc object.
textFrame = getTextFrame (marker.TextLoc, doc);

function getTextFrame (textLoc, doc) {

    var prop, textFrame;
	
	 // Get the text frame from the text location.
	prop = doc.GetTextPropVal (textLoc, Constants.FP_InTextFrame);
	if ((prop.propIdent.num) && (prop.propVal.obj)) {
		textFrame = prop.propVal.
...

Likes

Translate

Translate
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

A marker will have a TextLoc property and you can use this to get the parent TextFrame. Something like this:

var textFrame;

// Assuming marker is your Marker object and doc is your Doc object.
textFrame = getTextFrame (marker.TextLoc, doc);

function getTextFrame (textLoc, doc) {

    var prop, textFrame;
	
	 // Get the text frame from the text location.
	prop = doc.GetTextPropVal (textLoc, Constants.FP_InTextFrame);
	if ((prop.propIdent.num) && (prop.propVal.obj)) {
		textFrame = prop.propVal.obj;
		return textFrame;
	}
}

Likes

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
Explorer ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

LATEST

@frameexpert thank you for your help.

Likes

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