Announcement

Collapse
No announcement yet.

BC4 GUI Works - Script Has No Output

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • shadragon
    replied
    Thanks Aaron, your suggs worked great and my script is not only finished, but actually works as well. :P

    Appreciate the help. I'll be getting a PRO license in a few days. Cheers.

    Leave a comment:


  • Aaron
    replied
    You can email us privately at [email protected] along with a link back to this forum thread for our reference.

    If you can construct and capture a single call to bcompare (the actual command line) and the script that command line is calling, we can use that to see what might be happening. So something like the above examples. The script that constructs the command line isn't as useful, since it's hard to know exactly what text is getting put into it (depending on what it finds as it parses the folders).

    Leave a comment:


  • shadragon
    replied
    The source files are in a folder with several sub-folders. So my script generates a list of source switch configs, then creates the corresponding path to the month old config, then compares them.

    I'm happy to share a sanitized version of the script once it is working for everyones benefit, but can't for now because of company security policies. May I share it with you privately? Then you can see what I am doing. Thanks.

    Leave a comment:


  • Aaron
    replied
    1) and 2) When calling from the command line as BCompare.exe "@c:\script.txt" "1" "2" "3" "4" "5" every following quoted block of text is the next parameter. These can be file paths (most common usage) but any text can be passed into the script this way:

    bcompare.exe "@c:\script.txt" "c:\file1.txt" "c:\file2.txt" "c:\temp\report.txt" "bc report title"

    can then be referenced in the script as 1,2,3, and 4 variables:
    text-report layout:side-by-side options:display-context title:"%4" output-to:"%3" "%1" "%2"

    3) Not easily for your workflow. For a Folder level task, you can use the interface to save a Session (with a stored set of targets, criteria, filtering, etc) and that can be loaded in script using the load command. File level reporting does not support loading a file session, however. What settings in the interface were you needing to update or alter between tasks? They might be exposed in scripting in a way that I can help with. Generally, if you generate two reports from the interface (one after the other, using new Text Compare sessions) what steps are you taking and what settings need updating between each Session menu -> Text Compare Report execution?

    Leave a comment:


  • shadragon
    replied
    Hi All,

    Got the Powershell script working thanks to your feedback. It generates a list of current switch configs and the save folder it needs to reference for changes. All is working. Couple of small issues remaining.

    Script settings are:

    text-report layout:side-by-side options:display-context title:"Test Output" output-to:"C:\Temp\BC\Reports\BC_Report.txt" "%1" "%2"

    Couple of Q's

    1) There's two definable report output strings outlined. One in the script above and one following the bcompare.exe command (bcompare.exe "@c:\bcscript.txt" "c:\file1" "c:\file2" "c:\bcreport.txt") If I define the BC Report path in the script, I can leave it off the command, but it does not work if I do the reverse.

    How can I replace the "BC_Report" in the text file report to dynamically use the name of the switch being compared? I see there is a %3 variable listed in the HTML example, but I couldn't get that to work. That way I can have one report per switch named:

    1stFloor.txt
    2ndFloor.txt
    3rdFloor.txt ...etc.

    2) Looked on the BD4 online docs, but don't see how the %1 through %9 variables are defined. Is there a reference to these and their usage?

    3) Last, is there any way to set up a job in the BC GUI, then export the script settings for use in a script like:

    text-report layout:side-by-side options:display-context title:"Test Output" output-to:"C:\Temp\BC\Reports\BC_Report.txt" "%1" "%2"

    Thanks.

    Leave a comment:


  • Aaron
    replied
    Hello,

    Switch to:
    text-report layout:side-by-side options:display-context
    instead of display-mismatches.

    To configure the number of context lines, launch the interface, and in the Tools menu -> Options dialog, Text Editing tab, you can set the count.

    If you need more customization, I'd recommend launching a pair of test files in the Text Compare, and using the interface's Session menu -> Text Compare Report to iterate different report options and layouts. We can then help with the script that matches the layout you need.

    Leave a comment:


  • shadragon
    replied
    Text-Report is working and generates the line that is different, but there is no context. If I look at the switch config report and see "description *** Test Edit ***" I know one of the port descriptions has changed. but not which one of the forty-eight ports.

    Can BC4 give me the difference line plus a few lines before and after the difference to give me a specific location? That way I see something like:

    interface GigabitEthernet1/0/20
    description *** Test Edit ***
    switchport mode access




    Leave a comment:


  • shadragon
    replied
    Thank you Chris. There is no select as the PS script will run through the hundred or so config files and supply the file names automatically. I just wanted to get the base logic working before adding the additional code in the PS script.

    Working now. Cheers.

    Leave a comment:


  • Chris
    replied
    Text-report can operate on selected files or if used as a one-line command the two files to be compared need to be passed as arguments at the end of the scripting command.

    If your screenshot, it looks like you're using the one-line version of command (no prior select command) but not passing the names of files to be compared. That is why output is empty.

    Try this script:
    Code:
    text-report layout:side-by-side options:display-mismatches title:"Test Output" output-to:"C:\Temp\BC_Report.txt" "%1" "%2"
    Command line arguments are passed into Beyond Compare scripts as the variables %1 through %9.

    Leave a comment:


  • shadragon
    started a topic BC4 GUI Works - Script Has No Output

    BC4 GUI Works - Script Has No Output

    Good Day,

    Trying to set up a script to check some Cisco switch configs against historical copies. When I load the test files into the BC4 GUI, all works well and I see the differences, but when I run the script with the same files in Powershell I get blank output. No errors when I run the script. Not sure where I am going wrong.

    Screenshot attached of my various settings. Any suggestions would be appreciated.

    Thanks.

Working...
X