2 Replies Latest reply: May 15, 2014 9:58 AM by Nick Osdale-Popa RSS

    Using FindText() in a .vbs script to test a file

    DaveR _

      I get reports that may or may not contain data.  The null reports contain the text "No records found for processing", which I've built into my processing script using FindText():

      [font="courier"]'Test if it is a valid order file

      NoRecords = MonarchObj.FindText(True, "No records found for processing", False, False)

      If NoRecords = True Then

      ErrorType = "Not a valid order file - No records found for processing"

      ErrorMessage = MsgBox(ErrorType, vbSystemModal, "Error encountered during processing:")


      End If[/font][/quote]This identifies the null reports and halts processing, just like I want it to.  What it doesn't do is allow for the script to continue with a good report without clicking 'OK' to the 'Finished Searching' box that pops up.


      I want to use the search in order to determine how to process (or not) the file, but I don't need Monarch to report the results of the search itself.  Is there any way to supress this box?

        • Using FindText() in a .vbs script to test a file
          Data Kruncher

          Hi Dave,


          Unfortunately, I don't believe that you can easily suppress the dialog box, but I may have another solution for you.


          Instead of searching for the "No records found for processing" string with Monarch, you could use the DOS FIND command. When you run it with the /c option, you get a count of lines containing your search string, like: [font="courier"]  -

          MYFILE.TXT: 0[/font][/quote]where zero is found count.


          You could redirect the output of the FIND command from the screen to a disk file, then read that file to extract your value. Because the colon character is an illegal character for file names, you know that it will only appear before your value.


          Now based on that value, decide how to handle the Monarch processing.


          Just an idea. Some bright guy (like Nick     ) is bound to come up with something else.



          • Using FindText() in a .vbs script to test a file
            Nick Osdale-Popa



            Do you mind posting your entire script?


            I'm not getting the prompt in my tests.