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

get attribute value of .fm files with extendscript

Community Beginner ,
Dec 18, 2018 Dec 18, 2018

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

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

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

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

Hi, it works thanks

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