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 of the BridgeComposer scripting feature; and to be customizable to meet specific needs.
Script | Category | Description |
---|---|---|
AuctionAdjust.js | Adjust | This script will adjust all boards in a document that have complete auctions. Enter 1 to change "All pass" to three (or four) passes. Enter 2 to change three or four passes (without annotations) to "All pass". Boards with incomplete auctions will not be changed. |
ClearDoubleDummy.js | Adjust | This script removes the double-dummy information from all boards in a document. When added to the BridgeComposer Script menu, this may may be more convenient than using the BridgeComposer Tools→All Boards, Board→Clear commands. |
CombineScores.js | Reformat | When boards are played more than once, sometimes we get a file with multiple instances of each board, each scored individually. This script combines such multiple instances into a single instance with a Score Table. These new instances are appended to the end of the document. |
CommentaryClear.wsf | Adjust | This script clears the commentary in all boards in a PBN file. |
CreateDealType.wsf | Generate | This script creates random deals of a selected "type". First, the script prompts for the deal type. More than thirty types have been implemented, including opening bids, responses, overcalls, preempts, conventions, and more. 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. |
DupCheck.wsf | Report | 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. |
ExportCardsOnlyAsLIN.js | Export | The BridgeComposer "File→Export As Bridge Base Online (.lin)" menu command creates a LIN file containing the hands, auction, play, and commentary. This script creates a LIN file containing the hands only. |
FindHolding.wsf | Report | 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. |
FormatMatch.js | Reformat | This script formats a team competition for printing (or PDF output). It displays the auction and play from both rooms under a single hand diagram, and provides IMP scoring with running totals. It can also read and apply a text file that maps player logins to real names. |
gen.js | Generate | 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. |
grand.js | Report | 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. |
HandsByPlayer.wsf | Export | "Curtain card" layout on steroids. Useful for bidding practice, duplicate hand preparation, and similar functions. Prints each player's card holdings on a separate page. Prints card holdings for 36 or more boards using only four pages (one page per player position). Produces a HTM file ready for printing by your web browser (we suggest you enable the "background graphics" printing option). The printout looks like this. |
HRTitles.js | Reformat | 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. |
ImageAllBoards.wsf | Export | This script creates Enhanced Metafile (EMF) image files for all boards in a document. EMF files are good for inserting pictures into Microsoft Office (Word, PowerPoint). |
LayoutApply.wsf | Reformat | This script applies a specified BridgeComposer layout to all PBN files in a folder. |
RenumberBoards.wsf | Adjust | 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. |
Rescore.js | Reformat | This is an experimental script to re-score matchpoint pair games using alternative scoring methods such as Cross IMPS, IMPS with par datum, and BAM vs. par. It demonstrates a technique for parsing the PBN "ScoreTable" tag and tag section (using JavaScript "regular expressions") that may be useful in new scripts. |
Retroize.js | Adjust | Modifies a document so that its PBN may be more compatible with older programs. |
RoomClear.js | Adjust | 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. |
RotateBoards.wsf | Adjust | This script rotates the card holdings for all boards in a document. Each board's cards are rotated by a random number of seats (from zero to three). |
Scenario.js | Generate | 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. |
SolveBoard.wsf | Report | This script may be called from the BridgeComposer "Script" menu for in-depth double-dummy calculations, including "play position" solutions, trick-taking potential of all cards, and more. It also serves as an example of how to use the BridgeComposer automation interface to the double dummy solver. Several options may be activated by changing variable assignments in the script from "false" to "true". Requires BridgeComposer version 5.82 or later. |
STHideNames.js | Adjust | 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.) |
TabulateScores.js | Export | This script extracts score data from all the boards in a bridge document, calculates the "Par IMPS", and outputs the data to a spreadsheet CSV (comma-separated values) file. |
BCConst.js | Includable | This "includable" script defines symbolic names for some constants used for BridgeComposer object method call parameters. |
BCDeal.js | Includable | 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 a bitmask 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). |
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.