Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

FrameMaker unresponsive after running script, 'ENGINE BUSY'

$
0
0

Hello scripters!

 

I've recently run into a small problem and I'm wondering if anyone has experienced the same and/or could shed any light on the issue. I have a script which, when run on large (~250 page) documents, renders FM completely unresponsive and requires me to force quit the application. The script isn't anything fancy, it simply walks through the active doc and inserts index markers into specific paragraphs. These are the important bits:

 

// adds index markers to doc

function addIndexMarkers(doc, pgf)

{

    // walk through pgfs in the main doc flow

    while (pgf.ObjectValid()) {

        var pgfFmt = pgf.Name;

 

        if (pgfFmt == "thing1" || pgfFmt == "thing2") {

            var offset = getOffset(pgf);

            var text = getText(pgf);

            createMarker(doc, pgf, offset, "Index", text);

        }

        pgf = pgf.NextPgfInFlow;

    }

}

 

// returns the offset to first char in the provided pgf

// will return different values for structured and

// unstructured documents

function getOffset(pgf) {

    return pgf.GetText(Constants.FTI_String)[0].offset;

}

 

// returns the textual data of the provided pgf

function getText(pgf)

{

    var textItems;

    var text = "";

    textItems = pgf.GetText(Constants.FTI_String);

 

    for (var i = 0; i < textItems.length; i++) {

        if (textItems[i].dataType == Constants.FTI_String) {

            text += textItems[i].sdata;

        }

    }

 

    return text;

}

 

// creates an index marker and places it at the specified

// offset position within the given pgf

function createMarker(doc, pgf, offset, type, text)

{

    var textLocation = new TextLoc(pgf, offset);

    var marker = doc.NewAnchoredObject(Constants.FO_Marker, textLocation);

    var markerType = doc.GetNamedObject(Constants.FO_MarkerType, type);

    marker.MarkerTypeId = markerType;

    marker.MarkerText = text;

}

 

The script makes it all the way to the end, I see my "Script Complete" message then ESTK just keeps spinning and FrameMaker becomes unresponsive. If I stop the script and try to restart it, I get 'ENGINE BUSY'. Again, this only happens on large documents (both structured and unstructured). I tried with ~100 page docs and it works just dandy.

 

Any ideas on why this might be happening?


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>