Announcement

Collapse
No announcement yet.

How to interpret output after text compare

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to interpret output after text compare

    Hi All

    Need your help with some vb script that could be used to compare two txt files.

    Our application would generate log files in txt format and our job is to compare these txt files pre-release and post release.

    I want to go line by line and compare the text between the two sets of log files. There would be roughly 2000 of these logfiles so i dont want to open BC everytime i do a compare.
    want to store the result for both pass or fail to a variable.

    Is this something you guys have done in the past? if so can you guys please share the code.

    I am using the code below but this open BC everytime i do a comparision

    Option Explicit
    Dim WSHShell, BC4, LeftSide, RightSide, lResult
    Set WSHShell = CreateObject("WScript.Shell")
    BC4 = """C:\New folder\Beyond Compare 4\Beyond Compare 4\BComp.exe"""
    LeftSide = " ""C:\New folder\Beyond Compare 4\Test1.txt"""
    RightSide = " ""C:\New folder\Beyond Compare 4\Test2.txt"""
    lResult = WSHShell.Run(BC4 + "/quickcompare=binary " + + """" + LeftSide + """ """ + RightSide + """", 0, True)
    If lResult > 1 And lResult Then WSHShell.Run (BC4 + """" + LeftSide + """ """ + RightSide + """")


    regards

  • #2
    How to interpret output after text compare

    Hi All

    I use the below code to compare two text files using BC from vbscripting. I am getting a numerical output, but how should i interpret these numerical output

    Option Explicit

    Dim WSHShell, BC3, LeftSide, RightSide, Result
    Set WSHShell = CreateObject("WScript.Shell")

    Set Result = nothing

    BC3 = """C:\New folder\Beyond Compare 4\Beyond Compare 4\BComp.exe"""
    LeftSide = " ""C:\New folder\Beyond Compare 4\Test1.txt"""
    RightSide = " ""C:\New folder\Beyond Compare 4\Test2.txt"""

    Result = WSHShell.Run(BC3 + " /quickcompare" + LeftSide + RightSide, 0, True)
    msgbox Result

    If files are same i am getting output as 1 and if there is a tab space then i am getting a out of 12 and if there is some text difference then i am getting an output of 13.

    I am not 100% sure on how to understand these outputs. Is there any documentation which gives me this information?

    regards

    Comment


    • #3
      Hello,

      The return codes are documented in the Help file -> Command Line Reference chapter.

      1 = Binary Same
      12 = Similar (only Unimportant differences; configurable, but default to whitespace, comments, etc)
      13 = Rules-based different

      You can also see this status if you launch the graphical interface, load the files in the Text Compare, and review the bottom status bar for the overall results (as well as visually verifying how the file is compared).
      Aaron P Scooter Software

      Comment


      • #4
        Thanks for the information Aaron

        Are there any other status numbers that need to me noted?

        Comment


        • #5
          The full list is in the Help file -> Command Line Reference chapter, near the bottom of that page. This is in the Help menu for the current version of BC4 you are using, or online generally here: http://www.scootersoftware.com/v4help/

          2,11, and 100. 100 to catch general errors is the main other code to catch. There are a few specific codes, like 103, if you partially uninstall BC4, can help troubleshoot, but usually aren't needed day to day.
          Aaron P Scooter Software

          Comment


          • #6
            Aron,

            Any idea If i can use a variable for my LeftSide and RightSide inputs for the location of my file. All i need to do is input the file location using a variable rather than hardcoding it in the script

            Would it work? I am finding it hard to get it working.

            regards

            Comment


            • #7
              Hello,

              Are you still trying to construct a quickcompare command line? This construction is outside of BC4; all BCompare.exe needs is a properly constructed string. If you are having trouble, please output your string to a plain text file rather than attempting to call it and see what the text is. You can post an example here for us to help troubleshoot syntax.


              Semi-related:
              If you are trying to call into BC Scripting instead of /quickcompare, you can pass text along the command line as a variable to scripting. To test, I recommend first using the command line manually with:
              bcompare.exe "@c:\bcscript.txt" "c:\left.txt" "c:\right.txt"

              where the variables are accessed in script with %1 and %2 (often with quotes, to also handle any whitespace they might pass in).
              bcscript.txt:
              text-report layout:side-by-side output-to:"c:\bcreports\bcreport.html" output-options:html-color "%1" "%2"
              Aaron P Scooter Software

              Comment

              Working...
              X