4 Replies Latest reply on Jul 25, 2013 4:44 AM by Mac_rk

    Integrate two text files

    BEGINNER_X Level 3

      Hi All,

       

      I have two reports in the name of "Fpo.txt" and "Glphs.txt"

       

      1st Tool: check like fpo, 000, AU etc and generate report in the name of "Fpo.txt"

       

      2nd Tool: Check Glyphs, RGB, Overset, etc through Preflight panel and generate  report in the name "Glphs.txt"

       

       

      But my target is

       

      1. collect all the report(content) from "Fpo.txt" and paste into the first line of "Glphs.txt"

       

      2. generate report using preflight Panel  having contents like "LONG FORM REPORT (includes extra information)"

         

        script will find if the reports having contents "LONG FORM REPORT" the tool delete the LONG FORM REPORT contents.

       

        Need "SUMMARY REPORT" only

       

       

      Please find the Report below:

      __________________________________________________________________________________________ _______________

       

      INDESIGN PREFLIGHT REPORT

      Document: Untitled-2_glphs.indd

      Preflight Profile Used: aa

      SUMMARY REPORT

      --------------------------------------------------------------------

      COLOR (3)

         Colour space not allowed (3)

            000_014.jpg(page 2)

            Text Frame(page 3)

            't, qui' (6 chars)(page 3)

       

       

      LONG FORM REPORT (includes extra information)

      --------------------------------------------------------------------

      COLOR (3)

         Colour space not allowed (3)

            000_014.jpg(page 2)

               Problem: Content uses RGB

               Required: Colour spaces not allowed: RGB

               Fix: Edit the source file. Convert its colours to a valid colour space for this document, and update the link.

       

      __________________________________________________________________________________________ ________________________________________________

         

       

      Could anyone help me to find the solution.

       

      Regards

      Beginner_X

        • 1. Re: Integrate two text files
          BEGINNER_X Level 3

          Hi All,

           

          Could you please help how to concat or merge to .txt files contents.

           

          thanks

          • 2. Re: Integrate two text files
            Mac_rk Level 2

            look below code i think  it's help you...

             

             

            var myFile=File("/c/Temp" +"/" + "temp1.txt");

            var myFile1=File("/c/Temp" +"/" + "temp2.txt");

            if (myFile.exists)

                    {

                        myFile.open("r");

                        var Temps =  myFile.read();

                       myFile.close();

                    }

              if (myFile1.exists)

                        {         

                           myFile1.open("e");

                            myFile1.seek(0, 2)

                            myFile1.writeln(Temps)

                          myFile1.close();

                        }

            1 person found this helpful
            • 3. Re: Integrate two text files
              BEGINNER_X Level 3

              Hi Mac_rk,

               

              Thanks for your quick response...

               

              Above code is working fine. Thank you so much again.

               

              Could you help to find solution for my 2nd point "LONG FORM REPORT".

               

               

              Regards

              Beginner

              • 4. Re: Integrate two text files
                Mac_rk Level 2

                for ur second Q try this

                 

                var myFile=File("/c/Temp" +"/" + "Preflight Report.txt");

                if (myFile.exists)

                        {

                            myFile.open("r");

                            var Temps =  myFile.read();

                            alert (Temps)

                            myFile.close();

                            Temp =Temps .replace(/(LONG FORM REPORT (.|\n)*)/g,' ');

                            myFile.open("w");

                            myFile.write(Temp)

                            myFile.close();

                            myFile.close();

                 

                        }