To begin using these scripts, see Scripting Library Installation.
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".
These scripts require BridgeComposer version 5.61 or later.
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.
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. See also Retroize.js.
Check a PBN file for Auction or Play "Notes" that exceed 128 characters. Such notes will cause an export to LIN format to fail when BFC is used for conversion. As of version 5.86, BridgeComposer automatically checks for this before BFC is used. However, as of version 5.98, NetBridgeVu may be used instead of BFC, and this script may be used to find "Notes" that will be truncated.
Adjust the vulnerability rotation for Chicago play: None, dealer-side, dealer-side, Both. Specify the "a" argument for the alternate rotation: None, non-dealer-side, non-dealer-side, Both.
Remove the double-dummy information from all boards in a document. When added to the BridgeComposer Script menu, this may be more convenient than using the BridgeComposer Tools→All Boards, Board→Clear commands.
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.
Clear the commentary in all boards in a PBN file.
Create 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.
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.
For another generator that may be easier to customize, see Bridge Dealer on the Utility Software page.
Scan a folder (and optionally its subfolders) and perform BridgeComposer DoubleDummyAllBoards on all PBN files found.
Report 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.
Set all the show/hide controls to "show" in all boards of a document.
The BridgeComposer "File→Export As→LIN Classic Format" and "File→Export As→LIN Modern Format" menu commands create LIN files containing the hands, player names, auction, play, and commentary. This script creates a LIN file containing the hands only.
Scan a folder for PBN files, and then scan 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.
Format a team competition for printing (or PDF output). Displays the auction and play from both rooms under a single hand diagram, and provides IMP scoring with running totals. Can also apply a text file that maps player logins to real names.
Based on Example 2 in the BridgeComposer Help topic "Automation: Examples": Generate 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.
Demonstrates a technique for prompting for dates.
Customization ideas are discussed in the Help topic.
Based on Example 4 in the BridgeComposer Help topic "Automation: Examples": Scan a PBN file and list the boards on which a grand slam is makeable.
Extends the Help topic example by prompting for the PBN file to scan and copying the grand-slam boards to a new PBN file.
"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.
Update the titles in a hand record file (perhaps received from a third party such as ACBL or the Common Game).
The first time you run the script, it will ask you for your 'Site' title (your bridge club name), and it will create the file BCHRLayout.pbn in your "Documents" folder.
Thereafter, you may further customize the layout file loaded by the script (BCHRLayout.pbn in your "Documents" folder) using BridgeComposer.
This script may be called from the BridgeComposer "Script" menu to update the currently open document.
Create "Enhanced Metafile" (EMF) image files for all boards in a document. EMF files are good for inserting pictures into Microsoft Office (Word, PowerPoint).
Apply a specified BridgeComposer layout to all PBN files in a folder.
Toggle the BridgeComposer "Diagram position" setting (in "Format→Board Layout", General tab) between "Center" and "Float left". No other layout settings are affected.
Scan a folder (and optionally its subfolders) for LIN files and convert them to PBN.
Change all-caps player names to mixed case.
Remove non-standard tag pairs from a PBN file.
Scan commentary in all boards of a PBN file, replacing the UNICODE "white" heart and diamond characters with the corresponding BridgeComposer pips.
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.
Experimental script to re-score matchpoint pair games using alternative scoring methods such as Cross IMPS, IMPS with par datum, and BAM vs. par.
Modify a document so that its PBN may be more compatible with older programs. See also AuctionAdjust.js.
Clear the [Room] tag in all boards in a PBN file. The [Room] tag cannot be set using BridgeComposer (except with a script: see RoomSet.js). 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.
Set or clear the [Room] tag for the selected board in a document. BridgeComposer displays the [Room] tag in its toolbar drop-down board selector.
Rotate 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).
Based on Example 3 in the BridgeComposer Help topic "Automation: Examples": Generate 100 boards with fixed North/South hands and random East/West hands. Then compute the double dummy analyses and save the file.
Extends the Help topic example by prompting for the North/South hands and the output filename.
Randomly reorder the boards in a document.
Set the Dealer for all boards in a document, according to a specified pattern, and rotate each Deal accordingly. Export the resulting document as a BBO LIN file.
Fix up a SharkBridge PBN file opened in BridgeComposer so that it displays properly.
Show only selected boards in a hand record file (and hide the others).
BridgeComposer does not display the player names in a PBN file unless an auction is present. This script copies the player names to a commentary section so they can be seen.
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. Serves as an example of how to use the BridgeComposer automation interface to the double dummy solver.
Several options may be activated by appending an argument (containing option letters) to the command line.
Requires BridgeComposer version 5.84 or later.
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.)
Extract hand record data from all the boards in a bridge document and output the data to a spreadsheet CSV (comma-separated values) file.
Extract score data from all the boards in a bridge document, calculate the "Par IMPS", and output the data to a spreadsheet CSV (comma-separated values) file.
Convert a TXT file produced by Blue Chip Bridge to PBN.
Define symbolic names for some constants used in BridgeComposer object method call parameters.
Provide a Deal object that 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.
Provide properties including Suit.hcp, Suit.length, Hand.hcp.
Provide functions including Hand.longest(), Hand.hasCard(card), Hand.isBalanced(), Deal.format(dealer).
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.