No announcement yet.

BC automated comparison

  • Filter
  • Time
  • Show
Clear All
new posts

  • BC automated comparison

    We are in the process of evaluating the enterprise edition of BC3 and are coming up with some problems.

    We are looking to use BC to compare 2 pdfs which the user will initiate from our Win-Forms application and view the comparison in the BC application. We had also wanted to use Sessions to ignore some of the elements within the pdf (such as creation date).

    However when we try to use BC from a command line I am unable to select the session AND pick the two files at the same time;
    bcomp.exe "TestSession" "z:\Test1.pdf" z:\Test2.pdf"
    compares the TestSession with the Test1.pdf,

    when I then try to do this via a script
    load "FolderSession"
    load "z:\compare1" "z:\compare2"
    compare CRC
    select all
    text-report layout:side-by-side output-to:"z:\compare1\test.txt"

    the text report is not really viewable by a user and I cannot figure out how to get the output into the BC application for viewing by a user. This is our first problem.

    Secondly we would like to have the Session dynamically pulled from our application to the user's machine. We found that it is stored in an xml file in the user's application data directory. Is there any way short of modifying the xml that we can generate the Session dynamically?

    We are really trying to make a scalable approach within our system using BC and really appreciate some help

  • #2
    It isn't possible to pass a session to load and two files on the command line. You'll need to change session defaults for the text compare, then just pass the two file names on the command line.

    To edit session defaults, open BC to the Home view, then expand "Edit session defaults > Text Compare" in the saved sessions list. Change the importance settings and save the changes.

    Your script can generate a report to printer, html, or plain text. It isn't possible to open a saved report interactively in Beyond Compare.

    It isn't possible to generate the session dynamically.

    You can save sessions to a file using "Tools > Export Settings", then have each user run "Tools > Import Settings" to get the settings.

    You can also save sessions to a file on a network drive and have each user specify it as a shared sessions file in the "General" section of "Tools > Options".

    One last option is to run BC's installer and select "create portable install". This stores BC and all of the settings XML files in a single folder. You can run BC from it to create all of the settings you want, then just copy the entire folder to each user's computer.
    Chris K Scooter Software


    • #3
      Chris' suggestion to use the defaults is definitely the easier way to go.

      With a bit of work, you can use script to load a session, filters to filter only the files you want, and then load new folder locations to perform session specific actions on any location/files.

      The trick is that script can only load Folder Compare sessions in the current release of BC3. Use the graphical interface to open a Folder Compare session, and then open a pair of files you are interested in. Alter the Session Settings in the Session menu -> Session Settings dialog. At the bottom left of this dialog is a dropdown box to Use for this View only. Change this to "Use for All files in parent session" ("Use for just these files" will not work for your workflow).

      Then go back to the Folder Compare and save it. Loading this in the first line of your script will allow you to use specific session settings by selecting a file and generating a report. The script you would be looking for would be roughly:
      load FolderSession
      criteria rules-based 
      filter "specificFileName.txt"
      load "z:\compare1" "z:\compare2"
      expand all
      select all
      text-report layout:side-by-side output-to:"e:\temp\synctest\report.html" output-options:html-color
      Your current script has a few problems:
      compare works on the current selection. criteria sets the background compare. Set criteria before a load command in order to make the load use that criteria. Otherwise load will trigger a criteria comparison, and criteria will trigger another one. Even better would be to have criteria saved in your FolderSession session, so you do not need to set it in script. Select all should select all.files, or diff.files or newer.files. The text-report command will not work if select all selects a folder.
      Aaron P Scooter Software


      • #4
        First off, thank you both for your replies.

        If I try to change the Session defaults for Text Compare I can change the importance however I do not see how I can change the Grammar elements to modify the keywords; please see the attached image as an example. So I do not believe this can work.

        If I use a script to perform the comparison it uses a Folder Compare Session which also does not allow exclusion of Grammar elements, or allow me to open up the BC tool which is a big stopping point for our users.

        Please advise we want to make this work but have specific requirements from our Business Users on how they want it to work. We need to be able to compare 2 pdfs with different file names and load the BC tool programatically (from command line either using a script or not), and exclude specific non important texts of the pdfs from comparison. If we can get this functionality this will work for us, otherwise I am not sure that this is the tool for us.

        Thank you


        • #5

          Here's a method to compare two files from the command line interactively:

          1) To edit the grammar elements, you'll have to edit the file format for your files in "Tools > File Formats". This setting is global for all comparisons matching the file extensions listed in the file format.

          2) In the saved sessions list, select "Edit session defaults > Text Compare". Go to the Importance tab. Uncheck a grammar item (keyword in your screen shot).

          3) Start the comparison with the command "bcomp.exe c:\file1.txt c:\file2.txt". This will open an interactive comparison of the files with differences in the unchecked grammar items treated as unimportant.

          As an alternative to an interactive comparison, you can also use a script to output the results of the comparison to an html file you can display in a web browser. Follow parts 1 and 2 as in the interactive instructions.

          3) Save the following script to c:\script.txt
          text-report layout:side-by-side output-to:%3 output-options:html-color %1 %2

          4) Run the script using the command:
          bcompare.exe @c:\script.txt c:\file1.txt c:\file2.txt c:\report.html

          This results in a color report.html that users can view in a web page to see differences.

          Both methods (interactive and scripted) require the initial setup of grammar definition in Tools > File Formats and Importance in the session settings. If you can't set these up interactively for your users, the only alternative is to edit BC's settings XML files, it isn't possible to set them from a script or command line switch. The file format settings are stored in "%APPDATA%\scooter software\beyond compare 3\BCFileFormats.xml". The session settings are stored in "%APPDATA%\scooter software\beyond compare 3\BCSessions.xml".

          If you are only using Beyond Compare from within your application, you can install Beyond Compare with the "create portable install" option in the installer. This installs Beyond Compare entirely in a single folder, including the XML settings files. This way you'll have one set of global Beyond Compare settings for all of your users.
          Chris K Scooter Software