Scripting Library

To begin using these scripts, see Example Scripts Quick Start, below.

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.)

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.)

These scripts 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 following scripts perform a variety of functions. They are intended to be useful as-is; to serve as examples of how to take advantage the BridgeComposer scripting feature; and to be customizable to meet specific needs.
This script creates random deals of a selected "type".

First, the script prompts for the deal type. Six 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
  5. Michaels cuebid
  6. Weak two opener
Then, the script prompts for the number of deals to create.

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).

You may customize the script to implement additional deal types to generate. See Adding New Deal Types for further information.

This script checks for and reports duplicate deals in a PBN file.

Duplicate deals could occur, for example, if in preparing a lesson file you copy and paste deals from various other files, and inadvertently include two copies of the same deal.

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 (BCHRLayout.pbn in your "Documents" folder) using BridgeComposer. For example, change 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.

In addition, this script allows you to adjust the Dealer and Vulnerability for all boards in a document.


This is an experimental script to re-score pair games using alternative scoring methods.

It demonstrates a technique for parsing the PBN "ScoreTable" tag and tag section (using JavaScript "regular expressions") that may be useful in new scripts.

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.)

"Includable" Scripts

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

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.

Example Scripts Quick Start

Script Favorites dialog panel
Script Favorites dialog panel
  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. In the "Script Favorites" dialog (see above), click the "Add" button (on its left side); a "File Open" panel will be shown.
  7. Open the BCScript folder created in step 3.
  8. Select the script or scripts you are interested in (use Shift+click and/or Ctrl+click to select multiple scripts). Then 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.

Repeat steps 4 through 9 as desired to add additional scripts.

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.