Skip to main content
Participating Frequently
July 20, 2021
Question

Get Marker text of type

  • July 20, 2021
  • 0 replies
  • 130 views

Hi community,

I try to get external links of doc using markers. I filter markers with type 'Hypertext' and search in them 'www', 'http'. 

Problem is that when working with big file, that contains more than 30000 markers FrameMaker crashes.

Here is the code that I use:

function getLinksFromDoc(oDoc) {
  
  var marker = oDoc.FirstMarkerInDoc
  var dLinks = {};
  var lTemp;
   while (marker.id) {
    if (marker.MarkerTypeId.Name = 'Hypertext' && (marker.MarkerText.match('URL') || marker.MarkerText.match('http') || marker.MarkerText.match('www') )  ) {
      markerText = marker.MarkerText;
      lTemp = markerText.split(' ');
      for (var i = 0; i < lTemp.length; i++) {
        if (lTemp[i].match('http') || lTemp[i].match('www')) {
          dLinks[lTemp[i]] = 1;
        }
      }
    } 
    marker = marker.NextMarkerInDoc;
  }

  return dLinks;
}

 

Does anybody know how to get only markers with specific type? 

What can I do to optimize the code?

    This topic has been closed for replies.