Navigation:  Samples >

Script.bld Sample

Previous pageReturn to chapter overviewNext page

This sample demonstrates how to integrate and call custom scripts for complex build capabilities.


1.Dictionary: Demonstrates initializing a collection of values using the Dictionary object, storing in a temporary macro, and using in a later step.
2.Numeric comparison: Using a VBScript expression to perform a numeric comparison and conditionally build the step.
3.Increment macro: How to call a script to increment a build number macro and then use the macro in the following step.
4.Process files: The next set of steps uses the Process Files action and a Run Script step to perform an incremental copy of the sample files to another directory.  The first time the project is built, all the files are copied, but if built again, it detects that all files are up-to-date and does not copy them. Note: The Copy Files action could also be used to do this, but this technique could be useful if other processing needed to be performed if a file was out of date.
5.Miscellaneous: How to create a shortcut from script, check for an application running, and using OLE Automation to modify an Excel spreadsheet.
6.Object model: Using the Visual Build object model to:
Log all steps and properties in a project
Dynamically create a new project and build it.  This could be useful if a build is driven by the contents of an external configuration file that determines what to build. Steps and macros can be added to the project, their properties set, and the project built to build all steps.  First, create a template step manually inside of Visual Build, then open the .bld file in a text editor and view that step's child elements to see what properties need to be set (or copy and paste the Log all steps and properties step from this sample into your project and build to see all steps and properties).  The action attribute is passed into the step Add method.
Show and manipulate the build objects during a build, and then logging the changes that were made.  This can be useful to configure Visual Build on a clean build box with the values pulled from config and macro files stored in source control, for instance.


The Logging.bld sample demonstrates some additional scripting techniques.