6 Replies Latest reply on May 1, 2017 10:44 AM by sebinkur

    Running ExtendScripts on FM and MIF Files.




      I was trying to run a script to extract all Paragraphs in a fm file with a specific tag name and I could see that I did not extract texts for many paragraphs.


      However when I saved the fm file as a mif file, and on running my script hereafter I was able to extract all paragraphs including paragraphs that were hidden.


      Please let me know why is there such a difference between running on a FM file and a MIF File.

      Secondly, If i were to update the MIF files with new paragraphs (and text ), could I save it as an FM file and use it interchangably.




      (Attaching my Script)


          var doc = app.ActiveDoc;

          var pgf= doc.FirstPgfInDoc;

          var count = 0 ;

          while (pgf.ObjectValid()){


              if (pgf.Name == 'Specific_Par_Name')


                   count += 1;

                   var test = pgf.GetText(Constants.FTI_String ); 

                   var text, str;

                   text = "";


                   for (var i=0; i < test.len ; i +=1)


                       var str=test[i] .sdata.replace(/^\s+|\s+$/g, '') ;

                       //var str=test[i] .sdata;

                        text = text + str;

                        //PrintTextItem (test[i]);



               //  file.writeln(text);




             // $.writeln(paraname);