If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Loading session using <comparison> parameter

24-Nov-2017, 03:37 PM

Hi,

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:
BCScript.txt
--------------------------------------------data-report layout:side-by-side &
options:ignore-unimportant &
output-to:%3 output-options:html-color %1 %2 &
"TestSession"
-------------------------------------------
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.

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

Comment

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?

Comment

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!

EDIT***
For reference, the batch file I use now is:
-------BC.bat-------
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
-----------------------------------------------

Comment

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.