BC 3 Text File compare without user interaction.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • donahue
    Visitor
    • Jan 2018
    • 5

    BC 3 Text File compare without user interaction.

    I have Beyond Compare 3

    I am using the commandline with script
    The command line has \silent

    command line arguments
    /@BCTextScript.txt /silent /closescript C:\temp\Roguewave\CaseCompareManual\Engine\CM\Case 96079338_39.xml C:\temp\CaseCompareManual\Case96079338_39.xml C:\temp\CaseCompareManual\FinalCompare\Case9607933 8_39.html

    My goal is to have no interation to the BC UI, BUT the BC UI comes up after the Compare happens.
    It displays the results of the comparison. I just want the results in a file. the user shouldn't even know that BC is running really.

    Following is a C# function content.

    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
    startInfo.FileName = @"C:\Program Files (x86)\Beyond Compare 3\BCompare.exe";
    string finalFile = ComparisonResultsPath + Path.DirectorySeparatorChar +
    Path.GetFileNameWithoutExtension(cmFilePath) + ".html";
    startInfo.Arguments = "/@BCTextScript.txt" + " /silent /closescript " + cmFilePath + " " + rwFilePath + " " + finalFile;
    System.Diagnostics.Process.Start(startInfo);

    How do I run BC without any interaction at all?

    I need to run multiple files through and do not need an instance coming up all the time.

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

    #2
    Hello,

    First, I'd recommend testing a generated string output from the Windows Command Line. This way we can troubleshoot the command line first before integrating it into an automated solution.

    If you run:
    "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" /@BCTextScript.txt /silent /closescript C:\temp\Roguewave\CaseCompareManual\Engine\CM\Case 96079338_39.xml C:\temp\CaseCompareManual\Case96079338_39.xml C:\temp\CaseCompareManual\FinalCompare\Case9607933 8_39.html

    You'll need to edit this to remove the slash in front of @, and quotes around the file paths to handle any whitespace."C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "@c:\folder\BCTextScript.txt" /silent /closescript "C:\temp\Roguewave\CaseCompareManual\Engine\CM\Cas e 96079338_39.xml" "C:\temp\CaseCompareManual\Case96079338_39.xml " "C:\temp\CaseCompareManual\FinalCompare\Case960793 3 8_39.html"

    Does this call work from the command line?
    Aaron P Scooter Software

    Comment

    • donahue
      Visitor
      • Jan 2018
      • 5

      #3
      Originally posted by Aaron
      Hello,

      First, I'd recommend testing a generated string output from the Windows Command Line. This way we can troubleshoot the command line first before integrating it into an automated solution.

      If you run:
      "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" /@BCTextScript.txt /silent /closescript C:\temp\Roguewave\CaseCompareManual\Engine\CM\Case 96079338_39.xml C:\temp\CaseCompareManual\Case96079338_39.xml C:\temp\CaseCompareManual\FinalCompare\Case9607933 8_39.html

      You'll need to edit this to remove the slash in front of @, and quotes around the file paths to handle any whitespace."C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "@c:\folder\BCTextScript.txt" /silent /closescript "C:\temp\Roguewave\CaseCompareManual\Engine\CM\Cas e 96079338_39.xml" "C:\temp\CaseCompareManual\Case96079338_39.xml " "C:\temp\CaseCompareManual\FinalCompare\Case960793 3 8_39.html"

      Does this call work from the command line?
      This command works"
      C:\Program Files (x86)\Beyond Compare 3>BCompare.exe "@c:\temp\BCTextScript.txt" /silent "C:\temp\Roguewave\CaseCompareManual\Engine\CM\Cas e96079338_39.xml" "C:
      \temp\Roguewave\CaseCompareManual\Engine\RW\Case96 079338_39.xml" "C:\temp\Roguewave\CaseCompareManual\Engine\FinalC ompare\Case96079338_39.html"

      I went back to the C# program took off the closescript option pointed my script file to temp.
      Still get the UI popping up at the end of the comparison.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16000

        #4
        Hello,

        Can you redefine the C# to output the plain text of what it is trying to call? There may be a typo comparing the manual command line vs. the script generated command line. Do you need to escape the '/'?
        Aaron P Scooter Software

        Comment

        • donahue
          Visitor
          • Jan 2018
          • 5

          #5
          Originally posted by Aaron
          Hello,

          Can you redefine the C# to output the plain text of what it is trying to call? There may be a typo comparing the manual command line vs. the script generated command line. Do you need to escape the '/'?
          I was able to get it working by executing a batch file.
          Batch File
          echo off
          set arg1=%1
          set arg2=%2
          set arg3=%3
          "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe " "@c:\temp\BCTextScript.txt" /silent %arg1% %arg2% %arg3%

          C# code

          public void BeyondCompare(string cmFilePath, string rwFilePath)
          {
          string finalFile = ComparisonResultsPath + Path.DirectorySeparatorChar +
          Path.GetFileNameWithoutExtension(cmFilePath) + ".html";
          //string command = @"""C:\\Program Files (x86)\\Beyond Compare 3\\BCompare.exe""" + " /@C:\\temp\\BCTextScript.txt" + " /silent " + cmFilePath + " " + rwFilePath + " " + finalFile;

          System.Diagnostics.Process proc1 = new System.Diagnostics.Process();
          proc1.StartInfo.FileName = @"C:\Temp\BCTextScript.bat";
          proc1.StartInfo.Arguments = $""{cmFilePath}" "{rwFilePath}" "{finalFile}"";
          proc1.StartInfo.CreateNoWindow = false;
          proc1.StartInfo.UseShellExecute = false;
          proc1.StartInfo.RedirectStandardInput = true;

          proc1.Start();
          proc1.WaitForExit();
          }

          Thanks for the guideance

          Comment

          Working...