PDA

View Full Version : Suggestion: linked/chained/included script files


BretSutton
31-Jan-2006, 10:32 AM
We have a file-sync procedure that is driven by a BC2 script that, in turn, loads a dozen or so sessions, one after the other, to perform the sync. Each part of the file-sync is also callable separately. I know of no way to do that directly with a BC2 script, so have split it into a dozen subscripts, each of which is a duplicate of part of the larger script, and invokable separately from the .BAT file wrapper.

From a programming standpoint, it would be nice if the code in the main script wasn't duplicated in all the little individual scripts. In other words, it would be cool if the main script could consist of a dozen or so statements, each one of which would call or include the little scripts. A new CALL <filename> or PERFORM <filename> script command could handle this. (I guess my COBOL background is showing through in my choice of commands. ;) )

Thanks for a great product!

Chris
31-Jan-2006, 02:25 PM
If you're doing the same type of sync in all the scripts, you can do this with a batch file and one script.

Beyond Compare supports passing command line arguments into scripts. The variables %1 through %9 inside of scripts will be expanded with command line arguments.

Here's an example script:
load %1 %2
sync update:lt->rt

Then create a batch file like:
bc2.exe @script.txt source1 target1
bc2.exe @script.txt source2 target2