Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Aug 2015
    Posts
    7

    Red face Ignoring unimportant differences using VBSCRIPTING

    Hello Everyone,

    I am new to using the softare beyond compare. We have 2 folders containing different files( viz notepads,.csv files etc). We need to compare the files of both the folders by ignoring umimportant differences like the date, timestap etc. using VBscripting.Is that possible? If not can anyone suggest any other alternatives to achive the same.

    Cheers!!

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,619

    Default

    Hello,

    The first step would be to setup the Unimportance in the graphical interface, defining a File Format and grammar elements, then marking these elements as Unimportant. You can then update the Session Setting defaults to mark them as Unimportant by Default. We have details on this setup here:
    http://www.scootersoftware.com/suppo..._unimportantv3

    Next, you can then use BCScripting, which is run from the command line with: bcompare.exe "@c:\bcscript.txt"
    where bcscript.txt contains a series of commands, such as generating a folder-report or text-report of multiple files. What type of output would you like to generate? You can also generate the report first in the graphical interface, and once you know which one you want we can help with the script needed to generate it on the command line.
    Aaron P Scooter Software

  3. #3
    Join Date
    Aug 2015
    Posts
    7

    Default

    Hello Aaron,

    Thanks for the reply. We have to generate reports in 2 environmnts and just compare for the differences between those. We have to exclude the date and time stamps which typically appears in the first or second lines of the reports. So while making changes to the GUI settings how exactly do we set this in the Grammar tab. Are we using any regular exp to do this?
    We generate reports which compares two reports side byside and shows the difference in red as a html file. We jut need the date and time not to be shown in red. Can you help me design the BC scripting for this. ?

    Appreciate your help Aaron
    Cheers!

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,619

    Default

    Hello,

    We can help with scripting, but you will want to set up in the graphical interface first. This way the defaults can be properly set so the script can then use them.

    The link above includes directions and a video for help to define grammars. What style reports are you comparing? Are they Beyond Compare generated reports or another style? You would want to open a Text Compare session, load your two files, then follow the grammar steps to define the grammars, then mark that grammar as Unimportant in the Session Settings. By default, a grammar is Important, which is then can be toggled to be Unimportant (per session or as a new Default).

    Our trial is fully featured, so please feel free to fully test any workflow before any purchase is necessary.
    http://www.scootersoftware.com/download.php
    Aaron P Scooter Software

  5. #5
    Join Date
    Aug 2015
    Posts
    7

    Red face Ignoring unimportant differences using VBSCRIPTING

    Hello Aaron,

    We are using text files which are situated in 2 different folders and comparing each report one to one. So i tried to set up the grammar tab following the video .
    For some reasons after i refresh the "Reload" tab in the beyond compare i am unable to see the changes. The date and timestamps are still showing as red. I have used the following text matching pattern as per the video(\d+/\d+/\d+\s\d+:\d+:\d+\s[AP]M) for time stamp and [0-9]{1,2}[a-z][a-z] [A-Z][a-z]* 20[0-9][0-9] for a date stamp( 12-Dec-2014) .Correct me if i am wrong in setting this up.
    After this what is the script to run the newly created log files. How to create that and how to execute that?

    Regards
    kprasad

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,619

    Default

    The pattern in the video is specific to a text pattern for dates. Is your "timestamp" in your text file setup as "10/10/1999 10:10:AM" with a single space between? If not, this pattern would not necessarily match any date string.

    The other RegEx you have defined: [0-9]{1,2}[a-z][a-z] [A-Z][a-z]* 20[0-9][0-9]
    does not appear to include '-' characters, so it wouldn't match on your provided 12-Dec-2014 sample. Is your month always 3 characters long? If so you could use:
    \d+-\w{3}-20\d+

    You will want to work with the graphical interface to test your Regular Expressions. Since scripting runs automatically, it can offer no feedback on your definitions and would be difficult to troubleshoot if you have correct or incorrect Regular Expression syntax. Regular Expressions can be tricky to define and require a bit of practice. Once you have them defined you can then work on the automation.

    My suggestion for the automation is to have it where:
    If you load a blank, new Text Compare, then drag and drop your two report files, your default settings are configured to automatically ignore the text you need to ignore.

    The script can then be:
    bcompare "@c:\bcscript.txt"

    where bcscript.txt is
    text-report layout:side-by-side options:display-mismatches output-to:"c:\bcreport.html" output-options:html-color "c:\YourFile1.txt" "c:\YourFile2.txt"
    Aaron P Scooter Software

  7. #7
    Join Date
    Aug 2015
    Posts
    7

    Default

    Hello Aaron,

    The date stamp on my report looks like 23-Feb-2015 and on the next line right underneth that we have the time stamp as 09:28am. So what would be regular expression to deal with this?

    Also do i just save the text-report layout:side-by-side options:display-mismatches output-to:"c:\bcreport.html" output-options:html-color "c:\YourFile1.txt" "c:\YourFile2.txt" in a notepad and save that as bcscript.txt.

    then from the command prompt we enter bcompare "@c:\bcscript.txt" to execute the script.

    Thanks for your immense help Aaron!!

    Cheers
    Kprasad

  8. #8
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,619

    Default

    The grammar would need to be per line, so you could have a Date grammar such as:
    \d+-\w{3}-20\d+
    and a timestamp grammar such as:
    \d+:\d+[ap]m

    And yes, you save the script command into a text file, which can have any name, you then call BC4 in scripting mode using the "@" to point to the script.txt file.
    Aaron P Scooter Software

  9. #9
    Join Date
    Aug 2015
    Posts
    7

    Default

    thanks Aaron. that has worked!! however now we have another small issue. When i am ignoring the date and timestamp that appears at the header it also ignores other date and time stamp within the body of the report that we don't want to ignore. Are there any regular expression to just ignore the date and time stamp that appears at the headers of the reports( possibly within the first 2 lines maybe) but doesn't ignore the same anywhere else in the body of the report?
    Below are the regular expressions that are working here for our reports:

    Date stamp \d+-\w{3}-20\d+
    Timestamp1 \d{2}:\d{2}:\d{2}[aA|pP][mM] ( this is for the reports that has time in format of HH:MM:SS)
    Timestamp 2 \d{2}:\d{2}[aA|pP][mM] ( this is for the reports that has time in format of HH:MM)

    Thanks
    kprasad

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,619

    Default

    You would need to define a longer RegEx that is unique to the format used in the Header, or use the Lines grammar item to match on a larger part of the Header (making that whole part of the Header Unimportant). The Lines grammar can match on a RegEx or just start at Line 1.
    Aaron P Scooter Software

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •