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;
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:
Copy link to clipboard
Copied
The following did not help to get a first valid AFrame object with the above mentioned snippet:
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).
Copy link to clipboard
Copied
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: