Announcement

Collapse
No announcement yet.

How to ignore specific strings when comparing two text files by scripting

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

  • How to ignore specific strings when comparing two text files by scripting

    Hi,

    I am BC 4.0 Pro registered user, I have a problem on scripting for ignoring specific string compare between two text files, as attached compared report in HTML format, I'd like to ignore those strings when comparing, current script I used:

    text-report layout:side-by-side options:ignore-unimportant output-to:%3 output-options:html-color %1 %2

    Because by my batch script it will judge the errorlevel code after comparing the files, if the code is 13 then the batch file will judge the comparison result as failed(means found different contain), which means, it is important for me that to ignore the strings and then make the errorlevel of bcomp result not be 13, I have tried to survey such threads and help guide but sorry I am newbie so I still need your help to direct me how to modify my script to ignore those strings.

    Thanks a lot!

    Jacky Lee
    Attached Files

  • #2
    I have tried to add "grammar element" to ignore those strings:

    ^CurrentClockSpeed=\d*
    ^LoadPercentage=\d*
    ^TimeOfLastReset=\d*.\d*-\d*

    It worked for me no matter on GUI or script mode on the local system, the red marked has changed to green one and the errorlevel code will become 12, it is easy for me to change my batch file to judge if errorlevel code = 12 then the result is pass.

    But, when I try to copy bcomp.exe, bcompare.exe and script.txt onto another system, then the Session setting will be gone and need to set the "grammar element" on the system again, plus, my batch script will be used on different systems, so it is not allow me to setup the "grammar element" on each systems one-by-one.

    Please advise what I can do to just have one modification and can be applied to all other systems, the Portable way(via USB key) is not suitable for me, because I need copy all batch scripts from USB key to all other test systems, and test all systems at the same time.

    Thanks a lot!

    Jacky
    Last edited by lasthero; 18-Sep-2018, 01:51 AM.

    Comment


    • #3
      The file format, grammar element, and session settings for importance are stored in Beyond Compare's user settings as XML files.

      For a regular installation (all users), the settings are stored in the folder:
      "%appdata%\scooter software\beyond compare 4".

      If you copy the settings XML files to the same locations on all other systems, then the script should work the same way. Interactively, you can also use Tools > Export Settings and Tools > Import Settings to transfer settings between systems.

      The other option is to install using Create Portable Install as the install type. Settings XML files are then stored in the same folder as the executable, bcompare.exe. Copying the portable install folder to every system where your batch script will run is a method to deploy the settings for a portable install.
      Chris K Scooter Software

      Comment


      • #4
        Hi Chris,

        Thanks a lot, it worked for me by Portable install, but that means the register key also need in same folder, when share the tool to others, you know.....

        Anyway, thanks for the answer.

        Jacky

        Comment


        • #5
          Hello,

          The Key can actually be outside of the Portable Install directory, but deployed into the %AppData%\Scooter Software\Beyond Compare 4\ directory. This way settings can be portable, while the key registration is controlled.
          Aaron P Scooter Software

          Comment

          Working...
          X