Running DBT from the Mac Terminal Window

A command line interface is one way of invoking a program in order to automate its operation, instead of working with it interactively. A second way to automate is with an Application Program Interface (API). DBT has both a command line interface and, on the Windows platform, it has an API as well.

DBT can be run from a command line on either Windows or Mac, i.e. from a DOS "Command Prompt" window or Mac "Terminal" window. Tasks such as importing a Word document or output to a brailler can be accomplished from the command line.

What follows is a relatively short discussion of a relatively advanced topic. Only those familiar with "shell" programming or some other form of computer automation will likely benefit from reading on.

The prompt in a command window normally displays the directory that it is pointing to. This directory is called the "current working directory." Here is the basic structure of a command that invokes DBT using an embosser named Romeo and an input file named constitution.htm:

dbt --braille:Romeo constitution.htm<Enter>

This example only works if the current working directory is the DBT directory and the data file is in the same directory, and this is admittedly not at all a common case. Most often users set the current working directory to where their data files are located, which means the path to DBT must be specified on the command line, like this:

/Applications/DBT.app/Contents/MacOS/dbt --braille:Romeo constitution.htm<Enter>

Users familiar with Environment Variables know that there are other options as well, but this discussion does not cover them. There are more examples at the end of this page, but first, here are the options for DBT operation from the command line.

Available Commands

The schema (general format) for calling DBT from the command line is:

PROGRAM --OPTIONS FILES

where the PROGRAM is DBT as illustrated above, including the path to DBT if the current working directory is elsewhere;

where one or more OPTIONS are given per the list below; and

where FILES represents one or more input files to be processed by this command.

Each OPTION on the command line must be preceded by a slash (on Windows computers) or a double hyphen (on the Macintosh). In many cases more than one option can be applied to the same DBT call. In the list of options below, each line [in square brackets] represents a group from which at most one alternative can be selected, with vertical bars separating the choices. Text that appears inside angle brackets, <like this> indicates names or values that the user must supply.

OPTIONS:

[ --print | --braille:<embosser-name> | --simulate | --brf:<file-name> | --prf:<file-name> ]

[ --Pagesize:<n-rows>x<n-columns> ]

[ --Copies:<n> ]

[ --Template:<name> ]

[ --wordstylemap:<name> ]

[ --RemoveEmbosserInfo | --RemovePrinterInfo | --RemovePageInfo ]

[ --dumpstyles:<name> | --dumpstyles_xml:<name> ]

Print --The first group provides the main output options: print output, braille output, simulated braille output, formatted braille file (brf), or print-proof file.

Pagesize -- sets or resets the dimensions of the output page. The user specifies the rows and columns, such as "24x40".

Copies -- the number of copies produced.

Template -- selects which document template to use (see example).

wordstylemap -- specifies a Word .mws file.

RemoveEmbosserInfo -- Removes embosser information embedded in the document(s), including all settings done in Document, Embosser Setup. This option saves the results back in-place and exits if no further processing is required.

RemovePrinterInfo -- Removes the ink printer information embedded in the document(s), including all settings done in Document, Printer Setup. This option saves the result(s) back in-place and exits if no further processing is required.

RemovePageInfo -- Combines the effects of RemoveEmbosserInfo and RemovePrinterInfo. Note that it is not actually possible to use those two separate switches together, hence RemovePageInfo is provided to strip both printer and embosser information from a document.

dumpstyles:<name> -- Writes ("dumps") the styles definitions for a document into the named file. If this option is used, only one input file can be specified. (The behavior of this option is undefined if more than one document file is specified.) After this option is processed, DBT will exit if there is no further processing to be done.

dumpstyles_xml:<name> -- Works just like dumpstyles, except that the "dump" file is written in XML format.

Examples

Once again, the path to the DBT folder is ignored for these examples, to concentrate on the use of different options.

To open and emboss two files (Florida.dxp, Georgia.dxp) to a named embosser (Romeo):

dbtw --braille:Romeo Florida.dxp Georgia.dxp

To open a Word document (Mass.doc), import it to DBT, and emboss three copies to a named embosser:

dbtw --braille:Romeo --Copies:3 Mass.doc

To open and create a brf file for one input file (notice the brf output file is first in this command line):

dbtw --brf:Michigan.brf Michigan.dxp

To open and create a brf file for one file (modifying the page dimensions):

dbtw --brf:california.brf --Pagesize:25x38 california.dxp

To open, import, and emboss all the *.doc files in the directory to a named embosser (Romeo):

dbtw --braille:Romeo *.doc

To open and emboss one file (span.doc) to a named embosser (Romeo) using a particular Template:

dbtw --Template:"Espanol con Contracciones" --braille:Romeo span.doc