Skip to main content
K.Daube
Community Expert
Community Expert
June 27, 2022
Answered

No anchored frames found

  • June 27, 2022
  • 1 reply
  • 211 views

Dear friends,

Again I need your sharp eyes. In the document I traverse there are at least 10 anchored frames.But the following while is immediatly skipped:

 

      oObject = oDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstAFrame;
      while (oObject.ObjectValid()) {
        sFound = oObject.UserString;
        oTL  = oObject.TextLoc;
        oUstring = new KLD_Z.oUserString("AFrame", sFound, oTL);
        aoUserStrings.push (oUstring);
        oObject = oObject.NextAFrame;
      }

 

What is hidden from my eyes?

Edit 2022-06-27 20:21

Working from the back does not help either. The resultant object is invalid:

oObject = oDoc.MainFlowInDoc.LastTextFrameInFlow.LastAFrame;

 

This topic has been closed for replies.
Correct answer K.Daube

After further tests it turned out that the flow name A was not available for the script, although the FM UI reported Flow A in the status line.

The situation could not be corrected by MIF wash.

I did this:

  • Create a new document portrait
  • Import all styles from the existing
  • Copy all contents of flow A to the new doc

1 reply

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthor
Community Expert
June 28, 2022

The following did not help to get a first valid AFrame object with the above mentioned snippet:

  • MIF wash the document with the 13 anchored frames
  • Create a new document with certain empty anchored frames

There are however no problems with this first-next method for tables.

For the anchored frames i needed to change to the find method - which works as expected:

 

 

  oObject = oDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf; // body pages only
  oTL = new TextLoc (oObject, 0);
  oDoc.TextSelection = new TextRange (oTL, oTL);;
  oFindParms = KLD_Z.GetFindParameters ("ANCFRM", "", 0, false, false, false)
//                                 (sType, sSearch, iMode, bWord, bCase, bBack)
    oTRfound = oDoc.Find(oTL, oFindParms);
    while (oTRfound.beg.obj.ObjectValid()) {
      oFrameTI = oDoc.GetTextForRange (oTRfound, Constants.FTI_FrameAnchor);
      for (k = 0; k < oFrameTI.length; k++) {
        oTextItem = oFrameTI[k];
        oObject = oTextItem.obj;
        sFound = oObject.UserString;
        oTL  = oObject.TextLoc;
        oUstring = new KLD_Z.UserString("AFrame", sFound, oTL);
        aoUserStrings.push (oUstring);
      }
      oTRfound = oDoc.Find(oTL, oFindParms);
    }

 

 

This collects all the anchored frames on the body pages (To check i  have added an anchored frame both on a master and a reference page).

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthorCorrect answer
Community Expert
June 28, 2022

After further tests it turned out that the flow name A was not available for the script, although the FM UI reported Flow A in the status line.

The situation could not be corrected by MIF wash.

I did this:

  • Create a new document portrait
  • Import all styles from the existing
  • Copy all contents of flow A to the new doc