Highlighted

Markers can be found, but are undefined

Advocate ,
Aug 05, 2019

Copy link to clipboard

Copied

Dear all,

File https://daube.ch/zz_tests/Endnotes-simulated.mif contains markers of type Cross-Ref which all can be found with Find dialogue or a corresponding script.

I wanted to replace this method by using a while loop with NextMarkerInDoc.

But after the first iteration the next marker is considered undefined (it would be the first relevant one).

What is going on here?

The output of the script (FM-15) below is this:

Type.Name: Cross-Ref

MarkerText: 39380: 1Heading: Gugus-file1

NextMarker: 1

NextMarkerText: 37202: zen-endnote: 1 Just a footnote with some local formatting.

#target framemaker

var oDoc = app.ActiveDoc;

  TestMarkers (oDoc);

function TestMarkers (oDoc) { // =======================================

var oMarker = oDoc.FirstMarkerInDoc;

  while (oMarker.ObjectValid()) {

    $.writeln("\n Type.Name: " + oMarker.MarkerTypeId.Name);

    $.writeln("MarkerText: " + oMarker.MarkerText);

    $.writeln("NextMarker: " + oMarker.NextMarkerInDoc.ObjectValid());

    $.writeln("NextMarkerText: " + oMarker.NextMarkerInDoc.MarkerText);

    oMarker = oDoc.NextMarkerInDoc;

  }

} //--- end TestMarkers 

Same effect also in FM-12.

Hi Klaus,

On line 12 you have a small mistake it should be like this:

oMarker = oMarker.NextMarkerInDoc;

I hope that helps?

Ian

TOPICS
Scripting

Views

455

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Markers can be found, but are undefined

Advocate ,
Aug 05, 2019

Copy link to clipboard

Copied

Dear all,

File https://daube.ch/zz_tests/Endnotes-simulated.mif contains markers of type Cross-Ref which all can be found with Find dialogue or a corresponding script.

I wanted to replace this method by using a while loop with NextMarkerInDoc.

But after the first iteration the next marker is considered undefined (it would be the first relevant one).

What is going on here?

The output of the script (FM-15) below is this:

Type.Name: Cross-Ref

MarkerText: 39380: 1Heading: Gugus-file1

NextMarker: 1

NextMarkerText: 37202: zen-endnote: 1 Just a footnote with some local formatting.

#target framemaker

var oDoc = app.ActiveDoc;

  TestMarkers (oDoc);

function TestMarkers (oDoc) { // =======================================

var oMarker = oDoc.FirstMarkerInDoc;

  while (oMarker.ObjectValid()) {

    $.writeln("\n Type.Name: " + oMarker.MarkerTypeId.Name);

    $.writeln("MarkerText: " + oMarker.MarkerText);

    $.writeln("NextMarker: " + oMarker.NextMarkerInDoc.ObjectValid());

    $.writeln("NextMarkerText: " + oMarker.NextMarkerInDoc.MarkerText);

    oMarker = oDoc.NextMarkerInDoc;

  }

} //--- end TestMarkers 

Same effect also in FM-12.

Hi Klaus,

On line 12 you have a small mistake it should be like this:

oMarker = oMarker.NextMarkerInDoc;

I hope that helps?

Ian

TOPICS
Scripting

Views

456

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 05, 2019 0
Enthusiast ,
Aug 05, 2019

Copy link to clipboard

Copied

Hi Klaus,

On line 12 you have a small mistake it should be like this:

oMarker = oMarker.NextMarkerInDoc;

I hope that helps?

Ian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 05, 2019 0
K.Daube LATEST
Advocate ,
Aug 05, 2019

Copy link to clipboard

Copied

Ian,

small, but powerful!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 05, 2019 0