No announcement yet.

Creation a session/workspace from script

  • Filter
  • Time
  • Show
Clear All
new posts

  • Creation a session/workspace from script

    I'd like to be able to create a session from a script (outside of BC). Or maybe invoke BC with a list of files/folders to compare.

    We have a bunch of scripts do some selective copying from a folder hierarchy (and doens't keep the same hierarchy). It would be handy if those copy scripts could also create a session file or something similar to run BC on the copy later.

    I'm using BC3 at the moment, but have access to BC4 if that helps.


  • #2

    Script files have to be manually written as .txt files, and BC4 does not have a method to generate that file. If you use another external script or code to parse a folder-report, you could theoretically output a report, parse it, and then modify either BCSessions.xml or script.txt on the fly, and then running another script again. This is basically manually updating a file that isn't generally accessed by the user, but is open as plain text.

    The general strategy would be to use script with variable support, such as:
    bcompare.exe "@c:\bcscript.txt" "c:\variable 1" "c:\variable 2" "c:\variable 3"
    where the text of variable can be accessed in script as "%1", "%2", "%3," etc. As long as you know the text before calling to scripting, you can pass the text into the script file to populate specific variables or features of the script file (usually a folder or file path).

    This support is pretty much the same between BC3 and BC4. BC3's Help file -> Scripting Reference chapter or the Using Beyond Compare -> Automating with Script chapter will have more detailed documentation and examples.

    Let us know if you have any question.
    Aaron P Scooter Software