PDA

View Full Version : Complicated Scripting Question


Clouseau
01-Oct-2011, 09:22 AM
Hi Guys,

I am looking to create a rather complicated script for BC and was hoping to get some help or insight on how to create it. Essentially I am looking to create a script that performs three actions within one script:

1. Examines two folders containing xml files. It then generates a report showing the differences between the two folders in terms of missing files and indicates which ones were missing. So, if there were 230 files in one folder and only 200 in the other, it would generate a report telling the user which 30 were missing from the folder.

2. Once this report is generated, all the equal files (matching files in both folders) will be compared and a html report showing a side-by-side comparison will be generated for each file. Thus, if there were 20 files, there would be 20 html reports.

3. Finally, when this type of report is generated, it should be able to classify and label them with the files' name. Also, depending on if there were important or unimportant differences in these files they would be stored in the appropriately labeled folder.


In addition, this script has to be fairly user friendly so that a user can quickly go in and modify which folders are being examined, where the reports will be generated to and change the BC session being loaded.

I know this is a lot to ask and believe me I am working hard myself to solve this quandry as well but I thought since you were the experts you might be able to offer me some direction.

I really appreciate your time in helping me out with this,

Trevor

Aaron
04-Oct-2011, 10:02 AM
Hello,

Script is a series of sequential steps. So you'll want to script each step similar to taking actions in the graphical interface. It may also help to take these actions in the main interface to walk through them and see how they work before attempting to automate the whole process.

Setup: BCScript.txt can be called from the command line with parameters, such as:
bcompare.exe "@BCScript.txt" "c:\folder1" "c:\folder2" "c:\reportname1.txt" "c:\reportname2.html"
These parameters can then be referenced in the script as %1, %2, %3 and %4

Then, in script, "load %1 %2" to load the two folders.

1.
expand all
folder-report layout:side-by-side options:display-orphans output-to:"%3"
#display-orphans will show only the orphan files, files that only exist on one side or the other.

2.
expand all (if you are testing each of these steps individually, they all need expand all. otherwise, you only need it once, just like clicking the button in the graphical interface)
select exact
text-report layout:side-by-side output-to:"%4" output-options:html-color
#This will generate one report file. We do not have a method of generating 20 different report files for each equal file. You would need to pass in the file name pairs manually.

3. This links to the comment in #2, but we cannot auto-generate a report per file, so each report would also not get the file names. You can manually name a report as part of the output-to or given using the "title" argument.

The script above would be fairly user friendly, since they would just need to change the parameters on the command line, not the script itself. The other alternative is to use the graphical interface to perform these steps, as it does provide more feedback and preview information, and is generally more user friendly.

Does the above help with your workflow? Let us know if you have any questions.