May I chime in here concerning the first question ... (FM-15)
Walking through the anchored frames of various documents with the script below shows a strange behaviour:
In a new document with newly inserted AFrames all are found/reported.
In existing documents - even MIF washed - in some document all AFrames are found/reported, but in some documents only few AFrames are found/reported (After restarting FM and/or the script always the same AFrames).
What may be the cause of such erratic behaviour?
/* E:\_support+consultancy\!_FM-community\GetFirstEmptyFrame1.jsx ==== UTF-8
History 2022-02-15
*/ ; // =====================================================================
//@target framemaker
function DisplayObj (oDoc, obj) { // ----------------------------------------
obj.GraphicIsSelected = true;
oTLbeg = new TextLoc(obj,0);
oTLend = new TextLoc(obj,Constants.FV_OBJ_END_OFFSET);
oTR = new TextRange(oTLbeg,oTLend);
oDoc.TextSelection = oTR;
oDoc.ScrollToText(oTR);
} //--- end DisplayObj ------------------------------------------------------
function main () { // <><><><><><><><><><><><><><><><><><><><><><><><><><><><
var oDoc, oFlow, oTFrm, oAFrm;
oDoc=app.ActiveDoc;
if (!oDoc.ObjectValid()) {
alert ("A document must be active");
return;
}
oFlow= oDoc.MainFlowInDoc;
oTFrm= oFlow.FirstTextFrameInFlow;
while (oTFrm.ObjectValid()) {
oAFrm= oTFrm.FirstAFrame;
while (oAFrm.ObjectValid()) {
DisplayObj (oDoc, oAFrm); // display this anchored frame
oAFrm = oAFrm.NextAFrame;
alert ("Aframe found");
}
oTFrm = oTFrm.NextTextFrameInFlow;
DisplayObj (oDoc, oTFrm); // display this text frame
}
} //--- end main ------------------------------------------------------------
main ();