No announcement yet.

headless mode text compare

  • Time
  • Show
Clear All
new posts

  • headless mode text compare

    Is it possible for BC3 to do a text file compare behind the scene (headless mode) and launch only if there is a difference(s) to show up the difference? Basically, I'm comparing a bunch of files programmatically and would like if it wont launch/open unless it spots a difference.

    Also, can it ignore the differences like date and folder location? how?
    I'm comparing text reports created at different times and stored at different locations but the I am interested in the contents than this "meta-data". I saw that there is a way to specify rules to ignore words using session settings but how to specify date and directory path as umimportant differences?
    Full path: <path2.txt>
    July 20, 2012

    comparing this with another report:
    Full path: <path2.txt>
    July 30, 2012

    I want to compare the reportcontents part only; rest is unimportant.

    Any help is appreciated.
    Thank you!

  • #2

    In the Tools menu -> Options dialog, Startup section, you can set "When starting with file comparison, show quick compare dialog", then enable this to be Rules-based and "Open view automatically if files are different". Any files selected using the Windows Explorer right click menu will then pop up this dialog that will show the files are equal, or will launch BC3 and show the differences.

    If from scripting, you would need to use bcomp.exe /qc. This will return an errorlevel code which you can capture and then act upon. Detailed documentation can be found in the Help file, Command Line Reference chapter. I suggest initially testing on the command line using /qc "c:\file1" "c:\file2"
    echo %errorlevel%
    to see a simple example and the expected results. Then attempt to incorporate into a larger script, which only calls bcomp.exe "@c:\script.txt" when the error level is a specific value you are looking for.

    Scripting itself will follow the Text Compare default session settings. You can alter which grammars are important or unimportant by default on the Home screen, in the Saved Sessions list, expand the Edit session defaults folder, select Text Compare, and Uncheck those grammar names in the Importance tab.

    If you need to create a new grammar to match on this meta data, please see this KB article and Video:

    Let us know if you have any questions.
    Aaron P Scooter Software