• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

No anchored frames found

Community Expert ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

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;

 

TOPICS
Scripting

Views

105

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
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 28, 2022 Jun 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

Votes

Translate

Translate
Community Expert ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

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).

Votes

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
community guidelines
Community Expert ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines