In the FM doc, you should be running the script against the first paragraph in the flow (typically Flow "A", but FM docs can have many flows). The first paragraph in the document may not be the first thing that you see in on a Body page. The Body page shows the flow content.
Arnis, is there really a difference processing FM binaries and MIF files, when they are opened in FM. I wasn't aware about that, yet, but I also can't really imagine with my way of thinking how FM works in Background.
@sebinkur: Yes you can add paragraphs and save MIF back to binary format.
There should be no difference between an FM binary file and a MIF file after they are opened and sitting in memory. When you open a MIF file with FrameMaker, the MIF parser should convert it into a binary representation, which is what your script would operate on.
One possibility for the differences: Does your file have conditional text that may have been hidden before you saved as MIF? It could be that when you opened the MIF file, the MIF parser made all of the conditional text shown.
Depending upon how the FM file was created, saving as MIF organizes and cleans up the internal database, so I think it's possible that some items in the document order may be re-arranged vs. accessing those in the flow order. However, my scripting experience is much more ad hoc and most of my stuff is generated as MIF first via Miramo, so I'll defer to your and Rick's expertise on this.
Thank you. I was able to do that.
My script does have conditional text, so I do have a check in my script to extract text if the "ConFmtisShown". This does extract everything when I'm running on the mif file.
As Arnis suggested, there may be many flows in the document, probably due to which I am only able to extract a subset of all the text that I could otherwise extract from a mif file. Could you let me know how I could modify my script to accommodate all the flows or an other way I could tackle this problem?