How to use saved "ignore" session settings in batch file script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jockser
    Visitor
    • Dec 2014
    • 3

    How to use saved "ignore" session settings in batch file script

    Hi,

    Can anyone tell me if it's possible to load a saved session to run in my batch scripts?

    For example, I have a session called "Ignore_NULL", which ignores all "NULL" strings in a file compare. This works fine when I do a manual file compare in an open Beyond Compare session, i.e. via the front end app. However, I have most of my compares saved as scripts which I run as a batch file. How do I load my "Ignore_NULL" settings into these?

    If I append "/iu" it doesn't seem to work, I guess I need to specify which session I want to run in the script. I tried:

    load "Ignore_NULL"

    But this gave me an error, saying load session on applies to folder compares.

    My example script "Side_By_Side":

    file-report layout:side-by-side &
    options:display-mismatches &
    output-to:%3 %1 %2

    Then my batch file to call it is:

    "C:\BeyondCompare\BCompare.exe" @"C:\BeyondCompare\Side_By_Side.txt" "C:\BeyondCompare\LeftFile.csv" "C:\BeyondCompare\RightFile.csv" "C:\BeyondCompare\Report.txt" /iu

    Basically I just want to be able to run the same session ignore settings in batch / command line mode.

    Thanks in advance!
  • Aaron
    Team Scooter
    • Oct 2007
    • 16000

    #2
    Hello,

    Beyond Compare's scripting does not support loading a session other than a saved Folder Compare session. If you are running the above script and generating a file-report, this would use the default session settings for that session type.

    For .csv files, these would load in the Data Compare session type (not Text Compare) by default. The file-report command picks the session type based on the default file format; if you use text-report or data-report you can force a specific report type. Which report type do you intend to use?

    Either way, the method would be to update the default session settings for that session type on the Home screen, in the Saved Sessions list, in the Edit session defaults folder, select the appropriate session (Text or Data) and change the defaults that you want to be used for this report.

    You can then test first in the graphical interface by loading a blank version of that session, drag in your files, and immediately generate a report. If this generates as you expect without making any importance changes, then the text-report or data-report will use the same settings (when script is run with the same Windows User account).

    How does this work for you?
    Aaron P Scooter Software

    Comment

    • jockser
      Visitor
      • Dec 2014
      • 3

      #3
      Hi there,

      Thanks for your quick reply. Apologies - I forgot to mention I'm using Beyond Compare 4 (not 3), if this matters.

      I don't see any option for Data Compare in v4, just a text compare, so I guess it's choosing text compare by default?

      I also don't see any Edit session defaults folder (maybe down to v4). But see attached image - what I've done is added "NULL" to ignore list in:

      Home >> Sessions >> New >> Text Compare

      Is this the correct method to update default session by compare type? I thought this would update the default session for text compare. Then I reran the following script via batch file:

      file-report layout:side-by-side &
      options:ignore-unimportant,display-mismatches &
      output-to:%3 %1 %2

      It does the compare, but still prints out all lines containing "NULL", even though the output report indicates "ignoring unimportant".

      Hope this makes sense?


      Click image for larger version

Name:	Screenshot.png
Views:	1
Size:	98.2 KB
ID:	76309
      Thanks.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16000

        #4
        Hello,

        Thanks, I've moved this thread to the BC4 forum. This also changes several of the details of the instructions.

        To edit session defaults, it is available in the New folder in the Sessions list. Right click Text Compare, then select Edit. You will also need to verify that you have a Tools menu -> File Format, use the + to create a New Text Format for "*.csv" files. Then also update your script from file-report to text-report.

        To verify things are in place, first use the GUI and open a new, blank Text Compare, and drag in your files. This should open with your newly defined format and the Unimportant text should be blue or black in color (not red) if the defaults are set up correctly. If this is not the case, we'll need to fix this before moving on to scripting.
        Aaron P Scooter Software

        Comment

        • jockser
          Visitor
          • Dec 2014
          • 3

          #5
          Brilliant... Works exactly as I wanted now :-) Thank you so much!

          Comment

          • SkiTrak
            Journeyman
            • Jul 2018
            • 18

            #6
            I have the same need and I tried following the instructions you provided for version 4 (I have 4.2.5 build 23088) but they do not seem to work for me. When I right click on the Text Compare I do not get a popup menu. Am I doing something wrong or did the interface change?

            Comment

            • SkiTrak
              Journeyman
              • Jul 2018
              • 18

              #7
              I figured out how to edit the default settings for a text compare.

              So now if I do it in the GUI in a new text session it works as expected. But when I run my script it does not. Here is the script I am using and the cmd file:

              text-report layout:side-by-side &
              options:display-mismatches &
              output-to:%3 %1 %2

              bcomp.com /qc /closescript @test.script M:\xxxx\yyyy\zzz\aaaa_bbb_cc.xml M:\aaaaa\bbbbbb\ccc\ddd\xxxxyyyyzzzz out.txt
              rem if not "%errorlevel%" == "0" goto end
              type out.txt
              :end

              Comment

              • SkiTrak
                Journeyman
                • Jul 2018
                • 18

                #8
                Found my mistake. I needed to add the ignore-unimportant

                Comment

                Working...