No announcement yet.

Loading session using <comparison> parameter

  • Filter
  • Time
  • Show
Clear All
new posts

  • Loading session using <comparison> parameter


    I would like to load a session using the "data-report" command (among others).

    I have saved a session using the UI named "TestSession". I then call a simple script via command line:
    data-report layout:side-by-side &
    options:ignore-unimportant &
    output-to:%3 output-options:html-color %1 %2 &

    But I end up with the uninformative error:
    "A fatal error has occured:
    Unable to create report
    The script will now exit."

    The script would otherwise work without the last parameter. I was wondering what is the correct way to invoke the <comparison> parameter so I can load a session with some rules I need for my comparison, or maybe there is some other mistake I am making.

    Hong Wang

  • #2
    The *-REPORT commands only accept one of a session name or a pair of filenames. To do what you want, I'd suggest changing the saved session so it uses environment variables (like "%LEFT_FILE%") as the paths, then set the variables to the correct values before calling BC with the script. Loading the session settings as a template for arbitrary files is on our wishlist and I've added your request as a vote for it.
    ZoŽ P Scooter Software


    • #3
      Thanks for the quick reply!
      I changed the element in BCSessions.xml to <Left Value="%BC4_LEFT_FILE%"/>
      and in my batch script I call
      set BC4_LEFT_FILE ="C:\Users\p123e9f\Desktop\FileDiff\FileDiff\TestF iles\a.txt"
      I have also tried several variations of this (quotes and escapes) but always get a generic error message.
      Could you please explain what exactly to set the element and environment variable for this to work?

      As a side note

      Hong Wang


      • #4
        The SET line shouldn't have quotes, but otherwise I think that should work. Can you email your script and batch file to along with a link back to this forum post?
        ZoŽ P Scooter Software


        • #5
          It seems that the <Left Value="%BC4_EXPORT_FRAMEWORK_LEFT_FILE%"/> element needs to be <Left Value="%25BC4_EXPORT_FRAMEWORK_LEFT_FILE%"/> instead. Setting it in the UI will change the xml settings properly. I can now pass the filenames and session as parameters (though filenames are passed through environment variables). Thanks for your help!

          For reference, the batch file I use now is:
          set BC4_EXPORT_FRAMEWORK_LEFT_FILE=C:\Users\p123e9f\De sktop\FileDiff\FileDiff\TestFiles\a.txt
          set BC4_EXPORT_FRAMEWORK_RIGHT_FILE=C:\Users\p123e9f\D esktop\FileDiff\FileDiff\TestFiles\b.txt
          ..\BC4\BCompare.exe @"BCScript.txt" ..\Report.html

          The XML subsection for the corresponding session has the element
          -----XML settings--------------
          <Left Value="%25BC4_EXPORT_FRAMEWORK_LEFT_FILE%"/>
          <Right Value="%25BC4_EXPORT_FRAMEWORK_RIGHT_FILE%"/>
          Last edited by Hong Wang; 28-Nov-2017, 10:42 AM.


          • #6
            Oh, right, the XML reader/writer has to escape the % character. Glad you got it working.

            If you modify the session from the user interface it should do the escaping automatically. You should change the ones at the end of the path to %25 too. They're only working now because the " after it isn't a valid hexidecimal character.
            ZoŽ P Scooter Software


            • #7
              Modifying the session from the UI does not change the end of the path to %25, but I will keep your advice in mind in case I run into problems later.