Scripting Library

You may perform many BridgeComposer functions from scripts written in languages such as JScript (Microsoft's implementation of JavaScript) and VBScript. (In Microsoft terminology, BridgeComposer can operate as a Windows Automation server.)

To install and begin using the following example scripts, see Example Scripts Quick Start, below.

For complete details, see BridgeComposer "Help→Help Topics", topics "Script menu" and "Automation".

BridgeComposer also supports classic ".bat-file" scripting. See BridgeComposer "Help→Help Topics", topic "Command Line Interface".

The following example scripts are all written in JScript (i.e., JavaScript) and are intended for you to customize for your own particular needs. (After downloading, you may modify them using Notepad or similar.) They require BridgeComposer version 5.61 or later.

Click here to download all the scripts in a single .zip file (recommended).

Important: When viewing a script file in your web browser, use "reload" (F5) to be sure you have the latest version.

The first three scripts are "includable", meaning that they are intended to be combined with a larger script. They may be combined using copy/paste, or (better) using Windows Script Host markup (see the .wsf files below).

This "includable" script defines symbolic names for some constants used for BridgeComposer object method call parameters.
This "includable" script implements a Deal object which breaks down a PBN [Deal] tag into an array of four Hand objects (for North, East, South, and West). Each Hand object contains an array of four Suit objects (for spades, hearts, diamonds, and clubs). Each Suit object contains an array of card ranks.

The properties provided include Suit.hcp, Suit.length, Hand.hcp.

The functions provided include Hand.longest(), Hand.hasCard(card), Hand.isBalanced(), Deal.format(dealer).
This "includable" script implements a getRandomBoard() function that returns a Board object with a random [Deal] tag.

For efficiency, this script generates boards in batches. Optionally, double dummy analysis may be calculated for the generated boards.
This script creates random deals of a selected "type".

First, the script prompts for the deal type. Four example types have been implemented:
  1. Strong 1NT opener, game-going or better response
  2. Strong 1NT opener, invitational or better Stayman response
  3. Major suit opener, splinter response
  4. South dealer with 12 or more HCP, some N-S slam makeable
Then, the script prompts for the number of deals to create.

You may customize the script to implement additional deal types to generate.

This script may be called either from the BridgeComposer "Script" menu (to add deals to an existing document), or by double-clicking (to create a new document).
This script scans a folder for PBN files, and then scans each PBN file for boards in which a player has a particular card holding.

As provided, the script prompts for a folder, and then lists all PBN boards where South holds seven or more spades to the AKQ.
This script is based on Example 2 in the BridgeComposer Help topic "Automation: Examples".

It generates a series of 36-board deal sets (Morning, Afternoon, and Evening) for each day in a specified date range. Each set consists of a PBN and a PDF file.

The script demonstrates a technique for prompting for dates.

Customization ideas are discussed in the Help topic.
This script is based on Example 4 in the BridgeComposer Help topic "Automation: Examples".

It scans a PBN file and lists the boards on which a grand slam is makeable.

This script extends the Help topic example by prompting for the PBN file to scan and copying the grand-slam boards to a new PBN file.
This script updates the titles in a hand record file (perhaps received from a third party such as ACBL or the Common Game). Customize the layout file loaded by the script to change settings, such as changing the "Site" to your own bridge club's name. This script may be called from the BridgeComposer "Script" menu to update the currently open document.
In BridgeComposer, you may renumber all the boards in a document starting with 1 (using Tools→All Boards, Tools→Renumber All followed [optionally] with Edit→Select All and Board→Auto Dealer/Vul).

This script does the same, but allows you to choose any arbitrary new first board number.
This is an experimental script to re-score pair games using alternative scoring methods.
This script clears the [Room] tag in all boards in a PBN file. The [Room] tag cannot be set using BridgeComposer, but it may be set in documents created by other programs. For example, it is typically set to "Open" or "Closed" when BridgeComposer imports BBO LIN files. BridgeComposer displays the [Room] tag in its toolbar drop-down board selector.
This script is based on Example 3 in the BridgeComposer Help topic "Automation: Examples".

It generates 100 boards with fixed North/South hands and random East/West hands. Then the double dummy analyses are computed and the file is saved.

This script extends the Help topic example by prompting for the North/South hands and the output filename.
Sometimes, the player names in the Score Tables created via Tools→Import Score Data are incorrect or otherwise undesirable for some reason. You should probably submit a bug report, but you may use this script to hide the names until a fix is available. (The Score Tables will still show the player pair numbers.)

Example Scripts Quick Start

  1. Click here to download all the scripts in a single .zip file.
  2. In Windows, open the file downloaded in step 1 (
  3. Click on "Expand All" (to create the BCScript folder and its contents).
  4. In BridgeComposer, click on the "Script→Favorites" menu command.
  5. You will get a warning message about erroneous/malicious scripts. Click "OK".
  6. Click the "Add" button (on its left side); a "File Open" panel is shown.
  7. Open the BCScript folder created in step 3.
  8. Select the script or scripts you are interested in, and click "Open".
  9. Back in the "Script Favorites" dialog, click "OK".
Now, setup is complete. In BridgeComposer, click the "Script" menu and (at the bottom) you will see the scripts you selected in step 8. Simply select a script from the "Script" menu to run it.

DISCLAIMER: Software from this site is provided "as is". In no event shall the author be liable to you or any third party for any damages of any kind arising out of or relating to the software or the use thereof.