Skip to main content
Jacob_AA
Known Participant
December 18, 2018
Question

get attribute value of .fm files with extendscript

  • December 18, 2018
  • 2 replies
  • 393 views

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

This topic has been closed for replies.

2 replies

Jacob_AA
Jacob_AAAuthor
Known Participant
December 18, 2018

Hi, it works thanks

4everJang
Legend
December 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