View Full Version : C# Scripting with BC 3
Jeremy J
25-Feb-2010, 02:48 AM
Hi-
I have some C# code to make a call to BC 3 with a text file that has some scripting commands in it. See code below:
static void argus()
{
Beyond(@"c:\\Scripts\\MyScript.txt");
}
static void Beyond(string f)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "D:\\Program Files\\Beyond Compare 3\\BCompare.exe";
startInfo.Arguments = f;
Process.Start(startInfo);
}
This code however does not execute my script file (MyScript.txt) instead it opens a session of BC 3 and loads the text from my script file to do a compare on. I just need the script file to be executed like I am running it through the command line.
Please advise if this is possible, let me know a solution.
Thanks,
Jeremy
Chris
25-Feb-2010, 09:26 AM
I'm not familiar with C#, but it might help to try placing the @ character inside the quotes.
Aaron
25-Feb-2010, 12:46 PM
In addition to Chris' suggestion:
To call script from the command line, we use the @symbol to designate that. So it would be
"C:\Program Files\Beyond Compare 3\BCompare.exe @c:\folder\script.txt"
To clarify a couple parts of your code:
Beyond Compare, by default, installs to C:\Program Files. Do you have a D:\Program Files as well? Also, if you are running a 64bit system, is it installed to Program Files\ or Program Files(x86)\?
Jeremy J
25-Feb-2010, 07:12 PM
Thank you both for the reply.
I figured it out.
Beyond(@"c:\\Scripts\\MyScript.txt");
SHOULD BE: Beyond("/@"c:\\Scripts\\MyScript.txt"/");
Is there a script that can do a text compare instead of a folder compare that will just show differences between the two files?
Aaron
26-Feb-2010, 10:31 AM
Hello,
You can use the text-report command and give it two files directly as arguments. There is an example of this in the Help file under Using Beyond Compare -> Automating with Scripting -> Sample Scripts: Comparing two files by name.
The example uses the older file-report, but you can use that or the other report types:
file-report layout:side-by-side &
options:display-mismatches &
output-to:%3 %1 %2
The command line call would be
bcompare.exe @script.txt file1.txt file2.txt report.txt
Jeremy J
03-Mar-2010, 07:16 PM
I am having trouble with my script now. It doesnt like the fact that the path to the directory, C:\Program Files , I want has a space in it. Any advice? Here is my script.
criteria size
load C:\Program Files C:\Program Files
expand all
folder-report layout:summary options:display-mismatches output-to:S:\Clients\BC3FolderCompareReport_2010Mar030914 40.xls output-options:html-color
Michael Bulgrien
03-Mar-2010, 10:22 PM
Enclose the path in double quotes
Aaron
04-Mar-2010, 03:09 PM
Hello,
You may need to use quote around the file path. Also, just in case, if looks like you are loading the same folder on both sides of the compare, so all of the files will always be equal.
criteria size
load "C:\Program Files" "C:\Program Files"
expand all
folder-report layout:summary options:display-mismatches output-to:"S:\Clients\BC3FolderCompareReport_2010Mar030914 40.xls" output-options:html-color
paolabs
09-Jul-2010, 12:52 PM
Hello,
I am trying to do the same thing, although eventually I will need to feed the folder & report locations from a db, I'm starting with just being able to call the script from the c# web app. However all I get is a blank window and the process never ends, while if I run it directly from my cmd it runs in just a couple of seconds, do any of you guys know why this would be happening?
Thanks,
Paola
Aaron
12-Jul-2010, 09:38 AM
Hello,
What blank window are you seeing? It is a Beyond Compare dialog or your application? If you have the Log command as your first script line, does it activate and make a log? What step does it get to?
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.