Skip to main content
Participant
Jun 8, 2020 7:42 AM UTC
Answered

Delete all markers starting with "Part No" and type "Index"

I want to delete all the Index markers in a framemaker document that are starting with text Part No.

Is this possible with Framemaker scripting?

    This topic is closed to new replies. Start a new post to keep the conversation going.
    frameexpert
    frameexpertCorrect answer
    Community Expert
    Jun 8, 2020 11:26 AM UTC
    #target framemaker
    
    var doc, marker, nextMarker, regex;
    
    // Set a variable for the active document.
    doc = app.ActiveDoc;
    // Make a regular expression for the text.
    regex = /^Part No\./;
    
    // Process all of the markers in the document.
    marker = doc.FirstMarkerInDoc;
    while (marker.ObjectValid () === 1) {
        nextMarker = marker.NextMarkerInDoc;
        // Make sure it is an Index marker.
        if (marker.MarkerTypeId.Name === "Index") {
            // Check the text.
            if (regex.test (marker.MarkerText) === true) {
                marker.Delete ();
            }
        }
        marker = nextMarker;
    }
    www.frameexpert.com

    2 replies

    frameexpert
    Community Expert
    frameexpertCommunity ExpertCorrect answer
    Community Expert
    Jun 8, 2020 11:26 AM UTC
    #target framemaker
    
    var doc, marker, nextMarker, regex;
    
    // Set a variable for the active document.
    doc = app.ActiveDoc;
    // Make a regular expression for the text.
    regex = /^Part No\./;
    
    // Process all of the markers in the document.
    marker = doc.FirstMarkerInDoc;
    while (marker.ObjectValid () === 1) {
        nextMarker = marker.NextMarkerInDoc;
        // Make sure it is an Index marker.
        if (marker.MarkerTypeId.Name === "Index") {
            // Check the text.
            if (regex.test (marker.MarkerText) === true) {
                marker.Delete ();
            }
        }
        marker = nextMarker;
    }
    Translate
    www.frameexpert.com
    Participant
    Jun 10, 2020 9:27 AM UTC

    Thank you.

    Translate