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

get attribute value of .fm files with extendscript

Community Beginner ,
Dec 18, 2018 Dec 18, 2018

Copy link to clipboard

Copied

I want to get concept-outputclass value with extend script ?

TOPICS
Scripting

Views

297

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
Advocate ,
Dec 18, 2018 Dec 18, 2018

Copy link to clipboard

Copied

Hello Jacob,

It is a little unclear what you are asking for:

a) Getting some properties of a File object for an .fm file ?

b) Getting the value of the outputclass attribute on a DITA concept ?

I am guessing you mean to ask the second question. To get an attribute value of an element in any structured file, you need the following code:

function GetAttribute( oElement, sAttribute )

{

  /*  This function retrieves the value of the named attribute on the element. */

  var oaAttrs = oElement.Attributes;

  var sRetVal = "";

  var i = 0;

    var bFound = false;

    while( i < oaAttrs.length && !bFound )

    {

  if( oaAttrs.name == sAttribute )

        {

  bFound = true;

  if( oaAttrs.values.length > 0 )

  {

  sRetVal = oaAttrs.values[0];

  }

        }

        i++;

  }

  return sRetVal;

}

Then find the concept element, which is the root of your document:

var oConcept = app.ActiveDoc.MainFlowInDoc.HighestLevelElement;

and get the @outputclass value

var sOutputClass = GetAttribute( oConcept, "outputclass");

Kind regards

4everjang

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
Community Beginner ,
Dec 18, 2018 Dec 18, 2018

Copy link to clipboard

Copied

LATEST

Hi, it works thanks

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