Get Find count of the TextFrame
Hi,
For each text frame, I used to get the page number. Presently, InDesign documents with 6 text frames will display page numbers for just four of the text frames, not all of the text frames. Here is the script I used to do it.
var MSIDvalue = [];
var myXMLFile;
var getsearchtextpageNUmber = [];
var getxmlvalues =[];
var getCDATAValue = [];
var InddFrameValue = [];
var getPageNumberValue = [];
var getsearchtextpageNUmber ;
var getsearchtextpageNUmber =[];
var myGroup = app.activeDocument;
var allPageItemsOfGroup = myGroup.allPageItems;
for(var n=0;n<allPageItemsOfGroup.length;n++){
var myObject = allPageItemsOfGroup[n].getElements()[0];
if(myObject.constructor.name === "TextFrame" )
var myFrame = app.activeDocument.textFrames;
var mySelectedXMLItem = myFrame[n].associatedXMLElement;
if(mySelectedXMLItem != null && mySelectedXMLItem.markupTag.name != null)
var node_TBGUID = myFrame[n].associatedXMLElement.xmlAttributes.itemByName("MSID").value;
MSIDvalue.push(node_TBGUID);
var myFrames = myFrame[n].texts[0].contents;
app.findGrepPreferences=NothingEnum.NOTHING; //to reset the Grep search
app.findGrepPreferences.findWhat = myFrames; //the word(s) you are searching
var find = app.activeDocument.findGrep (true); //execute search
var a = app.activeDocument.findGrep( true )
for (var r = 0; r < a.length; r++)
getsearchtextpageNUmber.push(a [r].parentTextFrames[0].parentPage.name) ; //output
}
