Copy link to clipboard
Copied
Hi professionals,
I have used this code to find the textframe count but it shows an script error. Please guide me
var myDoc = app.activeDocument;
var myText= 0;
for (var i = 0; myDoc.stories.length > i; i++)
myText += myDoc.textFrames[i].texts.length
alert("Document contains " + myText + " textframe.");
Try
alert(app.activeDocument.textFrames.length);
This will count all text frames, including the ones placed in any master page.
Copy link to clipboard
Copied
This code to me seems to be incoherent. Why do you iterate stories and then check the text length and conclude that it would be the frame count. Try to find answers to the following question
--Manan
Copy link to clipboard
Copied
Try
alert(app.activeDocument.textFrames.length);
This will count all text frames, including the ones placed in any master page.
Copy link to clipboard
Copied
You tell correct. but it come anchore or inline text frame then it not countable.
Thanks,
Copy link to clipboard
Copied
Hi Thiru5CD0,
if you want to count or access all text frames in the document you have to loop all textContainers arrays of all stories in the document and filter out the text paths that are also text containers.
Regards,
Uwe Laubender
( ACP )