home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / UTILS / TOOLS / AS_PB110.ZIP / POWERBAT.DOC < prev    next >
Encoding:
Text File  |  1994-03-12  |  113.2 KB  |  3,284 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                    PowerBatch
  9.                                   Version 2.0
  10.  
  11.  
  12.  
  13.                          COMPUTING SYSTEMS DESIGN, INC.
  14.                                4437 Ormond Trace
  15.                                Marietta, GA 30066
  16.                                FAX (404) 926-9590
  17.  
  18.  
  19.  
  20.  
  21.                                _______
  22.                           ____|__     |               (tm)
  23.                        --|       |    |-------------------
  24.                          |   ____|__  |  Association of
  25.                          |  |       |_|  Shareware
  26.                          |__|   o   |    Professionals
  27.                        -----|   |   |---------------------
  28.                             |___|___|    MEMBER
  29.  
  30.  
  31.         CSD, Inc. is a member of The Association of Shareware Professionals
  32.         and subscribes to all the policies and standards of this organization.
  33.  
  34.                          Copyright (c) 1990-1994 by CSD, Inc.
  35.                             All Rights Reserved Worldwide
  36.  
  37.                  This documentation was produced on December 31, 1993
  38.  
  39.  
  40.  
  41.  
  42.  
  43.                                Table Of Contents
  44.  
  45.  
  46.            
  47.      Introduction   . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1
  48.  
  49.            
  50.      Software Support   . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  51.  
  52.            
  53.      Concept Of Operation   . . . . . . . . . . . . . . . . . . . . . . . .  3
  54.  
  55.            
  56.      Installation   . . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
  57.  
  58.            
  59.      Constructing A PowerBatch Source File  . . . . . . . . . . . . . . . .  6
  60.  
  61.            
  62.      PowerBatch Commands  . . . . . . . . . . . . . . . . . . . . . . . . .  7
  63.  
  64.            
  65.      Command Summary  . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
  66.  
  67.            
  68.      Compilation Errors   . . . . . . . . . . . . . . . . . . . . . . . . . 45
  69.  
  70.            
  71.      Examples   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
  72.  
  73.  
  74.  
  75.  
  76.                                   Introduction
  77.  
  78.         PowerBatch is a Shareware product. Shareware is a distribution method,
  79.         not a type of software. With Shareware you get the ultimate money-back
  80.         guarantee...if you don't use the product, you don't pay for it.
  81.  
  82.         Shareware is not free software. Copyright laws apply to both Shareware
  83.         and commercial software, and the copyright holder retains all rights,
  84.         with a few specific exceptions as stated in this document. Shareware
  85.         authors are accomplished programmers, just like commercial authors,
  86.         and the programs are of comparable quality. (In both cases, you will
  87.         find good programs and bad ones!) The main difference is in the method
  88.         of distribution. The author specifically grants the right to copy and
  89.         distribute the EVALUATION VERSION of the software to anyone as long as
  90.         no remuneration is received for the distribution of the software
  91.         unless permission is granted in writing by the author.
  92.  
  93.         Shareware distribution gives users a chance to try software before
  94.         buying it. If you try a Shareware program and continue using it, you
  95.         are expected to register the software with the author. With
  96.         registration, you will receive the latest version of the software
  97.         without the evaluation titles and messages. With shareware you are
  98.         able to try the software on your computer with your own set of
  99.         peripherals, the only way to know if it will function in your own
  100.         environment. After deciding that PowerBatch is a software product that
  101.         you will use, then and only then do you pay for it. The ultimate trust
  102.         from the author! When you do pay for the software, you pay only for
  103.         the software, not for advertisement for the software which can cost
  104.         many times what the software actually costs.
  105.  
  106.         CSD, Inc. is a member of the Association of Shareware Professionals
  107.         (ASP).  ASP wants to make sure that the shareware principle works for
  108.         you. If you are unable to resolve a shareware-related problem with an
  109.         ASP member by contacting the member directly, ASP may be able to help.
  110.         The ASP Ombudsman can help you resolve a dispute or problem with an
  111.         ASP member, but does not provide technical support for members'
  112.         products. Please write to the ASP Ombudsman at P.O. Box 5786,
  113.         Bellevue, WA 98006 or send a Compuserve message via easyplex to ASP
  114.         Ombudsman 70007,3536.
  115.  
  116.         While CSD has no immediate plans to move, businesses do move from time
  117.         to time. Since shareware tends to remain on some bulletin boards
  118.         without update for many years, if the shareware author does move, you
  119.         may experience a problem in contacting the author. You may also
  120.         contact ASP to learn of the current address of any ASP member if you
  121.         experience this problem.
  122.  
  123.         This product was originally written to provide the user an alternative
  124.         to the standard DOS batch files, an alternative that produced
  125.         standalone executable .EXE programs. The original command set was
  126.         aimed primarily at providing capabilities that solved the classic
  127.         "batch" type application.
  128.  
  129.         Requests from current users of the product and a desire to provide
  130.         additional capabilities beyond these requests have driven the product
  131.         far beyond original expectations. This product has become not only a
  132.         replacement for solving the classic batch application, but a very high
  133.         level language capable of creating sophisticated applications.
  134.  
  135.                                         Page 1
  136.  
  137.  
  138.  
  139.  
  140.         PowerBatch compiled programs create all the details that are necessary
  141.         to create a professional microcomputer program. This product is
  142.         intended to provide a novice or beginning programmer the capability of
  143.         producing non-trivial programs with a high success rate AND providing
  144.         the experienced programmer with a tool which makes quick work of the
  145.         task of prototyping new applications.
  146.  
  147.         Trademarks
  148.         ==========
  149.         PowerBatch is a trademark of Computing Systems Design(CSD), Inc.
  150.         MS-DOS is a trademark of MicroSoft Corporation.
  151.         IBM and PC-DOS are trademarks of IBM Corporation.
  152.  
  153.  
  154.  
  155.  
  156.         Software Support
  157.         ================
  158.         Support for PowerBatch may be obtained by contacting CSD, Inc. on
  159.         Compuserve using Compuserve Mail (EasyPlex). Address inquiries to
  160.         Compuserve ID 72701,155. If you are not a Compuserve member, you may
  161.         obtain support by writing to:
  162.  
  163.                             Computing Systems Design, Inc.
  164.                                   4437 Ormond Trace
  165.                                Marietta, Georgia 30066
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                                         Page 2
  200.  
  201.  
  202.  
  203.  
  204.                               Concept Of Operation
  205.  
  206.         PowerBatch is a compiler for a very high level language. A high level
  207.         language is one which requires a small number of commands to generate
  208.         code to perform a task. This is at the opposite end of the spectrum
  209.         from a low level language which requires a large number of commands to
  210.         perform a specified task. Low level languages allow the programmer to
  211.         operate at the "bits and bytes" level but generally requires a high
  212.         level of familiarity with both the computer and the language itself.
  213.         Low level languages generally produce code segments that are of
  214.         minimum size and maximum speed. High level languages produce solutions
  215.         that are easier and quicker to develop with some compromise in size
  216.         and speed.
  217.  
  218.         PowerBatch has attempted to make development of executable modules as
  219.         easy as possible and produce modules that are fast in execution.
  220.         PowerBatch is a development tool that will allow experienced
  221.         programmers to develop applications in a minimum of time. It is
  222.         designed to introduce non-programmers to the creative world of
  223.         programming. Error checking and all the details that the experienced
  224.         programmer builds into a professional program are included
  225.         automatically in every PowerBatch compiled module.
  226.  
  227.         In addition to the more than 100 commands in the PowerBatch language,
  228.         any valid executable command (.EXE & .COM) as well as any of the DOS
  229.         intrinsic commands are valid within a PowerBatch source file and will
  230.         be "compiled". These .EXE, .COM and DOS intrinsic commands will be
  231.         executed via a shell and the PowerBatch .EXE program will continue
  232.         execution with the next compiled statement following the shelled
  233.         command. There are two main modules supplied with PowerBatch;
  234.         1)PowerBatch.EXE and 2)SMLMODEL.MDL. PowerBatch reads, parses the
  235.         source file, and compiles the source code extracting routines from
  236.         SMLMODEL. The result is a completely standalone .EXE file that
  237.         executes without SMLMODEL or PowerBatch.
  238.  
  239.         PowerBatch commands fall into 4 classes of commands;
  240.  
  241.               
  242.            1) Commands which provide systems information. These commands
  243.               provide the current color settings, the current date, the
  244.               current time, check for the existence of a valid drive letter,
  245.               and commands which check for the existence of a directory or a
  246.               file.
  247.  
  248.               
  249.            2) Commands which control the flow of the program. Execute
  250.               different portions of the program based on existence or non-
  251.               existence of directories or files. Compare the contents of one
  252.               variable with the contents of another variable or a constant
  253.               and execute different portions of the batch program based on
  254.               the results of the compare.
  255.  
  256.  
  257.               
  258.            3) Commands which provide string manipulation. Change a string to
  259.               all upper case characters, or all lower case characters.
  260.               Extract a portion of a string such as the first three
  261.               characters or the last four characters. Build a new string from
  262.               two existing strings by concatenation of the two strings.
  263.  
  264.  
  265.  
  266.                                         Page 3
  267.  
  268.  
  269.  
  270.  
  271.         
  272.                  
  273.              4) Commands which deal with screen writing and input from the
  274.               keyboard. These commands are the main power in the PowerBatch
  275.               system. Directly address any position on the screen and move
  276.               the cursor to that position to read or write text.
  277.               Automatically center a message or title on any line. Draw boxes
  278.               around portions of the screen to enhance screen appearance.
  279.               Read a single key from the keyboard, read the response to a
  280.               query that only accepts a yes or no response, read a string of
  281.               characters from the keyboard with a specified maximum length,
  282.               and read keys from the keyboard automatically changing the
  283.               characters to upper case.
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                         Page 4
  333.  
  334.  
  335.  
  336.  
  337.                                      Installation
  338.  
  339.         Installation is accomplished by executing the PBInstal program. It
  340.         seemed only fitting that this install program be a compiled PowerBatch
  341.         program.  The two main modules PowerBatch.EXE and SMLMODEL.MDL must be
  342.         located in the DOS path to allow you to compile PowerBatch programs
  343.         from any directory on your system. PowerBatch may be run on a system
  344.         as small as a single floppy drive system with 128K. There will be some
  345.         limit to the number of source statements that may be compiled on a
  346.         system this small as memory is dynamically allocated as compilation
  347.         progresses. A source file of several hundred statements can be
  348.         compiled on a small machine. The PBInstal program is strictly a file
  349.         copy program. It will ask you where you wish to place the PowerBatch
  350.         files and copy them to the specified directory. You may copy your own
  351.         files to various directories if you desire. You may even copy
  352.         PowerBatch.EXE and SMLMODEL.MDL to a directory not on your path if you
  353.         desire. If you do so, you may compile only from the directory
  354.         containing these two files.
  355.  
  356.         PowerBatch may be installed from any drive.
  357.  
  358.         Place your PowerBatch installation disk in any drive. Change to the
  359.         drive which contains the install disk by typing
  360.            A: <Enter>
  361.         or
  362.            B: <Enter>
  363.         If you downloaded PowerBatch from a bulletin board and it is now on
  364.         your hard drive then make the hard drive the default drive and change
  365.         to the directory where the PowerBatch programs reside. For Example:
  366.            C: <Enter>
  367.            CD \DOWNLOAD\LIBS
  368.  
  369.         Run the installation program by entering
  370.  
  371.            PBINSTAL <Enter>
  372.  
  373.         Follow the onscreen instructions to copy both the compiler and the
  374.         example files to your disk. Remember that you must copy both
  375.         PowerBatch.EXE  and  SMLMODEL.MDL to a directory defined to be in the
  376.         DOS search path in order to compile programs from any directory. If
  377.         you do not place these programs in a directory on the search path, you
  378.         will be able to compile from only the directory where they reside.
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.                                         Page 5
  397.  
  398.  
  399.  
  400.  
  401.                         Constructing A PowerBatch Source File
  402.  
  403.         Use your favorite text editor to create a printable ASCII file
  404.         containing PowerBatch source commands and DOS executable commands. A
  405.         printable ASCII file is one that may be typed to the screen (i.e. type
  406.         myfile.pwr <enter>) and the results printed on the screen contain only
  407.         the file contents. Most files created with a word processor are not
  408.         printable ASCII files unless you specify an ASCII file output option.
  409.  
  410.         Compile your source statements to create a .EXE executable module.
  411.         This is done using the PowerBatch compiler. The syntax is:
  412.  
  413.            PowerBatch MyFile [OutFile] [+M] [+D2] [+O]
  414.  
  415.         PowerBatch assumes the extension of the input file to be .PWR (i.e.
  416.         MYFILE.PWR) and will create an output file of MYFILE.EXE if no OutFile
  417.         parameter is specified. The input source file may be any DOS name of
  418.         your choice (including the extension). You may also specify an output
  419.         file name of your choice but the extension will always be .EXE. If you
  420.         do not enter the input file name on the command line, the program will
  421.         prompt you for the name. You must at this time enter the complete name
  422.         including the extension.
  423.  
  424.         If you wish to generate a list of all literals, variables, and labels
  425.         used in your PowerBatch program, add +M to the end of the command
  426.         line. This variable map will be written to the [FileName].MAP file.
  427.  
  428.         If you will be running the output from the compilation on any computer
  429.         that is operating under a version of DOS that is earlier than DOS
  430.         version 3.0, you must enter the compiler directive +D2. This directive
  431.         will cause the compilation to be much slower but the resulting .EXE
  432.         file will execute on computers running on DOS 3.0 and up at the SAME
  433.         SPEED as compilations made without the +D2 directive. If in doubt, use
  434.         +D2. A minute of compile time will eliminate future problems. If you
  435.         compile a program that has been compiled before and has generated an
  436.         .EXE file, you will be asked if you wish to replace this EXE file. To
  437.         compile in batch mode or to bypass this message use the overwrite parm
  438.         +O.
  439.  
  440.         If the compiler finds no compilation errors, the compiled version of
  441.         your source file will be generated. For an explanation of compilation
  442.         errors, see the section entitled "Compilation Errors". Compilation
  443.         errors appear on your screen as they are encountered and they are
  444.         written to a file named [FileName].MAP (i.e. if your input file name
  445.         is MYFILE.PWR, the error and map file will be MYFILE.MAP). The entire
  446.         source code is scanned each time you compile a PowerBatch program
  447.         (i.e. the compiler does not stop when an error is found, but attempts
  448.         to identify all errors on each pass). This means that some errors will
  449.         be the result of previous errors found in the source.
  450.  
  451.         If there are no compilation errors, the [FileName].MAP file will not
  452.         be created.
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                                         Page 6
  461.  
  462.  
  463.  
  464.  
  465.                                  PowerBatch Commands
  466.  
  467.         Commands, Variable Names, and Labels are not case sensitive.
  468.         Everything on the command source line is converted to upper case
  469.         except a literal which is enclosed within quotes. Either single
  470.         quotes(') or double quotes(") may be used to denote a literal.
  471.         Literals which are numeric such as color values, variable lengths,
  472.         etc. should not be enclosed in quotes. The compiler does evaluate each
  473.         literal (both alpha and numeric) in the same manner. The evaluation
  474.         process is 1) remove leading and trailing quotes if any, 2) attempt to
  475.         convert literal to numeric, 3) if numeric conversion is successful,
  476.         consider it a number, 4) if numeric conversion is unsuccessful,
  477.         consider it alpha numeric. This means that internally an operand of 3
  478.         and "3" will both be numeric.
  479.  
  480.         A semicolon which is not enclosed within quotes or a part of a command
  481.         is used to denote a comment. Semicolons which are part of a command
  482.         must not be preceded by a space. A comment begins with a semicolon
  483.         which follows a space not within quotes. Comments may appear anywhere
  484.         on the command line, but everything after a semicolon on a command
  485.         line is ignored. A comment may begin in column 1 by placing the
  486.         semicolon in column 1. The following are NOT comments:
  487.  
  488.            path=d:\;c:\util;c:\wp
  489.            path   "d:\;c:\util;c:\wp"
  490.            WriteLine   "Punctuation may be used within quotes;"
  491.  
  492.         These ARE comments:
  493.  
  494.            Variable ColorSave,3 ;save the original color
  495.            SetVar   Msg, ErrMsg ;set Msg to "Invalid input"
  496.  
  497.         The starting location on the command line of the command and the
  498.         operands is not important and tabs and spaces may be freely used for
  499.         readability.
  500.  
  501.         Variable names and command labels may be any length in the source but
  502.         are significant only through the first eight positions. This means
  503.         that any variable name or label that is equal in the first 8 positions
  504.         will be considered the same.
  505.  
  506.         Variables, Literals, and Labels
  507.         ===============================
  508.  
  509.         Variables
  510.         =========
  511.         A variable is a location in memory that you allocate and give a name
  512.         and a maximum length. Anytime you refer to the "name" of the variable,
  513.         you are referencing the memory locations set aside for this variable.
  514.         Variable names give you an easy way to manipulate data internally
  515.         within the computer. The following are examples of variables:
  516.  
  517.            Variable    CharIn,1
  518.  
  519.         This variable gives the name "CharIn" to one memory position. It might
  520.         be used to hold one character responses from the keyboard by the user.
  521.  
  522.  
  523.  
  524.                                         Page 7
  525.  
  526.  
  527.  
  528.  
  529.         
  530.              Variable    PBDir,79
  531.  
  532.         This variable appears in the PBInstal program and holds the name of
  533.         the directory where the PowerBatch compiler will be placed. It is
  534.         composed of the drive letter and directory entered by the user in
  535.         response to two questions during the installation process.
  536.  
  537.            Variable    CompName,35,"The ABC Company"
  538.  
  539.         This variable reserves 35 positions in memory and gives these
  540.         locations the name CompName. The PowerBatch compiler also places the
  541.         initial value "The ABC Company" in the first 15 positions of the
  542.         variable. The value of this variable may be changed by later
  543.         processing in the program. When this variable is referenced in the
  544.         program it will contain only 15 characters (The ABC Company) with no
  545.         leading or trailing spaces, assuming the program has not assigned a
  546.         new value.
  547.  
  548.            Variable    MsgClear,20,"                    "
  549.  
  550.         This variable contains 20 spaces and is named MsgClear. It will be
  551.         used to "clear" or overwrite with spaces an error message in your
  552.         program. Once you have displayed a message to the user, it should be
  553.         cleared as you continue with the program. This is done by overwriting
  554.         with spaces. Having a variable with the correct number of spaces makes
  555.         this task easier.
  556.  
  557.  
  558.  
  559.         Literals
  560.         ========
  561.         Literals are very much like variables which have a value but no name.
  562.         Literals are used in PowerBatch commands when you wish to pass an
  563.         actual value to the command instead of a variable. Note in the
  564.         following examples that literals containing numbers only are not
  565.         enclosed in quotes and literals containing any non-numeric characters
  566.         are enclosed in quotes. If you specify a number as a literal, either
  567.         convention is acceptable (3 or "3"). If you specify alphabetic
  568.         characters, the quotes are required. For readability, and ease of
  569.         entry, numeric literals usually do not contain quotes. Examine the
  570.         following examples of literals:
  571.  
  572.            Center      "Installation Program",1
  573.  
  574.         This command will center the literal "Installation Program" on line 1
  575.         of the screen. The text "Installation Program" must appear somewhere
  576.         in the program and it appears as a literal. It will occupy memory
  577.         positions and will have a value but you may not reference this value
  578.         by name. By instructing the compiler to write this literal, the
  579.         compiler automatically creates the memory locations and initial value
  580.         but gives it no name. The 1 is also a literal in this command. Each
  581.         time you use a literal in a PowerBatch program, the previously
  582.         assigned literals are checked for duplication and if the literal has
  583.         been previously assigned, the prior assignment will be used (i.e.
  584.         literal values will appear only one time regardless of the number of
  585.         times used).
  586.  
  587.  
  588.  
  589.                                         Page 8
  590.  
  591.  
  592.  
  593.  
  594.         
  595.              WriteAt     12,3,Msg1
  596.  
  597.         There are two literals in this command. The numbers 12 and 3 are both
  598.         created as literals. In this command they specify the column and row
  599.         location where the string Msg1 will be written. Again, the compiler
  600.         creates the memory locations and values for these literals, but no
  601.         names. If you were to write another command such as the Beep command
  602.         which specifies that the system speaker will beep at a certain
  603.         frequency for 3 times, the compiler will find the previously defined
  604.         literal "3" and use this value instead of creating another literal.
  605.  
  606.            Beep        ErrTone,8,3
  607.  
  608.         This is the Beep command referenced in the previous example. The beep
  609.         command will cause the speaker to sound at a frequency of ErrTone for
  610.         .8 second and repeat 3 times. The "3" literal will use the same memory
  611.         location reference as the WriteAt command used in the previous command
  612.         (i.e. another literal will not be created).
  613.  
  614.         Labels
  615.         ======
  616.         Labels are names of a particular place in your PowerBatch program that
  617.         you will go to without executing the previous command. You go directly
  618.         to this location in the program from another location in the program
  619.         based on a decision you have made in the code flow. Examples will help
  620.         explain:
  621.  
  622.            ReadYN      "Do you wish to continue [Y/N] ",InChar
  623.            Compare     InChar,"Y",,,GetDrive
  624.            Halt        999      ;end the program if "N"
  625.  
  626.            Label       GetDrive
  627.  
  628.         This group of commands writes the message on the screen and asks the
  629.         user to input either Y or N (the command will only accept these two
  630.         characters). A comparison is then made to a literal "Y" and the
  631.         compare command will jump to the location in the program named
  632.         GetDrive if a "Y" was entered or will execute the next command if "N"
  633.         was entered.
  634.            GoTo        NextCmd
  635.            .
  636.            .
  637.            .
  638.            Label       NextCmd
  639.  
  640.         In this most straightforward use of the label, the user simply uses
  641.         the GoTo command and jumps unconditionally to another point in the
  642.         program.
  643.  
  644.         External Commands
  645.         =================
  646.         External commands are entered just as PowerBatch commands are entered.
  647.         If you enter an external command and this command uses command line
  648.         parameters, these parameters may be passed as either variables or
  649.         literals. Remember that if the parameter is not numeric, it must be
  650.         enclosed in quotes or it will be treated as a variable. Any PowerBatch
  651.         statement which is an external command may contain a maximum of 7
  652.         command line variables. That is not to say that you may not pass more
  653.  
  654.                                         Page 9
  655.  
  656.  
  657.  
  658.  
  659.         than 7 command line parameters to an external program but that these
  660.         command line variables may not be contained in more that 7 PowerBatch
  661.         variables.
  662.  
  663.         For example:
  664.            Variable Parm1,5,"one"
  665.            Variable Parm2,5,"two"
  666.            Variable Parm3,5,"three"
  667.            Variable Parm4,5,"four"
  668.            Variable Parm5,5,"five"
  669.            Variable Parm6,5,"six"
  670.            Variable Parm7,5,"seven"
  671.            Variable Parm8,5,"eight"
  672.            Variable BigParm,80
  673.  
  674.            ExtPgm   (Name of an external program)
  675.  
  676.         A valid method for passing these parms in one PowerBatch parameter.
  677.  
  678.            Extpgm   "one two three four five six seven eight"
  679.  
  680.         Accomplishing the same thing with variables using 6 PowerBatch parms.
  681.  
  682.            Concat   BigParm,Parm1," "
  683.            Concat   BigParm,Parm2
  684.            Concat   BigParm," "
  685.            Concat   BigParm,Parm3
  686.            ExtPgm   BigParm,Parm4,Parm5,Parm6,Parm7,Parm8
  687.  
  688.         Examples of external programs as PowerBatch commands:
  689.  
  690.            Variable    InChar,1
  691.            ReadYN      "Do you wish a directory ",InChar
  692.            Compare     InChar,"Y",NextSec,NextSec
  693.            DIR         "/W"
  694.            SETUP       "> null"    ;printer redirection
  695.  
  696.            Variable    PgmName,12
  697.            Write       "Enter program name to compile "
  698.            ReadStr     PgmName
  699.            TPC         PgmName, "/ddebug"
  700.  
  701.         This third example of external commands show the use of two predefined
  702.         variables, ERRORLEVEL and DOSERROR. After the execution of "TestPgm",
  703.         we examine DOSError to find if the program executed OK (Possibly there
  704.         was not enough memory or the program could not be found on the DOS
  705.         path). After determining that the program executed OK, we examine the
  706.         exit code set by "TestPgm" to determine the flow of the remainder of
  707.         our program. This exit code will be found in the variable ERRORLEVEL.
  708.  
  709.            Variable    MsgLine,80
  710.            .
  711.            .
  712.            TestPgm     "Parm1 Parm2"
  713.            Compare     DOSError,0,,,RanOK
  714.            WriteLine      "TestPgm did not execute properly"
  715.            Halt        DOSError
  716.            Label    RanOK
  717.  
  718.                                         Page 10
  719.  
  720.  
  721.  
  722.  
  723.         
  724.              Compare     ErrorLevel,1,Chk2,,Option1
  725.            Concat      MsgLine,"Unexpected code : ",ErrorLevel
  726.            Halt
  727.            Label       Option1
  728.  
  729.         Note: PowerBatch programs may be executed by other PowerBatch programs
  730.         as external commands. An option of the PowerBatch Halt command is to
  731.         set the DOS errorlevel. You could then "pass parameters" from one
  732.         PowerBatch program to another via the ERRORLEVEL variable.
  733.  
  734.         Command Line Parameters
  735.         =======================
  736.         Command line parameters may be passed to a compiled PowerBatch
  737.         program. These command line parameters must be defined at compile time
  738.         and have special variable names. Up to 16 parameters may be passed to
  739.         a PowerBatch program. These parameters are named CLP%1 - CLP%16.
  740.         If you wish to pass parameters on the command line to your PowerBatch
  741.         program, define the command line parameter variables (CLP%1 - CLP%16)
  742.         in your PowerBatch source prior to compilation and when you run the
  743.         compiled program, any parameters entered on the command line will be
  744.         in the defined variable. Example:
  745.  
  746.            Source for SMARTCPY.PWR
  747.  
  748.            Variable    CLP%1,79    ;source file
  749.            Variable    CLP%2,79    ;target file
  750.            Variable    InChar,1
  751.            ReadYN      "Ready to copy the files [Y/N] ",InChar
  752.            Compare     InChar,"Y",NoCopy,NoCopy
  753.            COPY        CLP%1, CLP%2
  754.  
  755.         SMARTCPY FILE1 FILE2 will execute the DOS copy command and copy FILE1
  756.         to FILE2 if the user responds Y to the question.
  757.  
  758.         Changing Environment Variables
  759.         ==============================
  760.         Your computer memory contains a special area of memory called the
  761.         "Environment Area". This special area of memory contains the values
  762.         assigned to variables that are available to the DOS operating system
  763.         or to any application program running in your computer. These values
  764.         remain unchanged until DOS or an application program changes them. DOS
  765.         maintains special values in this area which the operating system uses.
  766.         Your current path and current prompt configuration are two of these
  767.         values. These values are normally set with the DOS PROMPT or PATH
  768.         command. If an application program like a compiled PowerBatch program
  769.         executes a DOS command, it is done via a "shell" or another copy of
  770.         your command processor (normally COMMAND.COM) which is started to
  771.         handle the execution of these DOS commands. When a shell is started,
  772.         DOS creates a copy of the environment area for this new shell and
  773.         makes the environment values available to the shell. Unfortunately,
  774.         when the shell is terminated (when the DOS command is complete) this
  775.         copy of the environment is erased from memory. If you execute a
  776.         PROMPT, PATH or SET [Variable] command, the copy of the environment
  777.         created for the shell to run the PROMPT, PATH, or SET command is
  778.         updated and immediately erased when the PowerBatch program is
  779.         finished. PowerBatch however, provides you a means to update both the
  780.         permanent copy and the current copy of the environment area with the
  781.         commands SETPATH, SETENV, and PROMPT.
  782.  
  783.                                         Page 11
  784.  
  785.  
  786.  
  787.  
  788.         Unfortunately, problems dealing with the environment area do not end
  789.         here. When DOS runs a program (like a PowerBatch compiled program), a
  790.         copy of the permanent environment is made and is the "active"
  791.         environment area in use during the running of the program. If you only
  792.         read the values of existing environment variables, there is no
  793.         problem. If you attempt to add new environment values, the amount of
  794.         free environment space is very limited. IT IS NOT THE AMOUNT OF SPACE
  795.         ALLOCATED BY YOU IN YOUR CONFIG.SYS FILE (or the default) MINUS THE
  796.         AMOUNT OF USED SPACE! The amount of "free" space appears to be only
  797.         the amount left after rounding up the amount of used space to the
  798.         nearest paragraph of memory (16 bytes).
  799.         The problem of allocating environment free space can be circumvented
  800.         by updating the permanent environment area with dummy values prior to
  801.         the execution of your PowerBatch file. This could be done with a small
  802.         PowerBatch program such as ENV-INIT.PWR as follows:
  803.  
  804.            SetEnv   Env1,'dummy value dummy value'
  805.            SetEnv   Env2,'dummy value dummy value'
  806.            .
  807.            .
  808.            .
  809.         When ENV-INIT terminates, the environment variables Env1 and Env2 will
  810.         have the dummy values and will now be a part of any environment area
  811.         copy passed to a running program. You could of course use the DOS SET
  812.         command from the DOS command line or initialize the environment
  813.         variables with dummy values in your AUTOEXEC.BAT file.
  814.  
  815.         Command Notation
  816.         ================
  817.         In the description of the commands which follow, that which appears
  818.         within brackets [ ] is optional and all other operands are required.
  819.         Any time a screen color may be specified in a command such as
  820.  
  821.            CLEARLINE LineNum,ForegrClr,BackgrClr
  822.  
  823.         the single attribute which is used in many color conventions may be
  824.         substituted for the pair of color attributes. For example, foreground
  825.         color 4 (red), background color 1 (blue), is identical to color
  826.         attribute 20 and the CLEARLINE command may be specified EITHER as
  827.  
  828.            CLEARLINE 14,4,1
  829.         or
  830.            CLEARLINE 14,20
  831.  
  832.         to clear line 14 on the screen to red foreground on blue background.
  833.         For this reason anytime that the operand pair of foreground color,
  834.         background color is required, the single color attribute may be
  835.         substituted for the pair. The compiler will not detect missing
  836.         background color attributes but will assume that the foreground is the
  837.         composite value.
  838.  
  839.         How do I calculate this color attribute? The composite color attribute
  840.         is the DOS shorthand method of keeping both the foreground and
  841.         background colors in one byte of memory. It may be calculated by
  842.         multiplying the background color by 16 and adding the foreground
  843.         color. See Appendix B for a complete list of composite color
  844.         attributes.
  845.  
  846.  
  847.                                         Page 12
  848.  
  849.  
  850.  
  851.  
  852.         Color Attribute = (Backgrnd X 16) + Foregrnd
  853.         RedOnBlue = (1 X 16) + 4 = 20
  854.         WhiteOnBlack = (0 X 16) + 7 = 7
  855.         YellowOnRed = (4 X 16) + 14 = 78
  856.         DOS uses the ASCII values 0 through 127 for all the colors available.
  857.         To make any color blink, add 128 to the color value.
  858.  
  859.         YellowOnRed,Blinking = 78 + 128 = 206.
  860.  
  861.         Command Syntax
  862.         ==============
  863.         Several examples are available on the distribution disk. All source
  864.         code examples have a file extension of .PWR. These examples may be
  865.         edited with your favorite text editor and printed by "copying" the
  866.         file to the printer such as COPY PBINSTAL.PWR LPT1.
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.                                         Page 13
  912.  
  913.  
  914.  
  915.  
  916.                        ?COLOR Foreground, Background, Composite
  917.  
  918.         Retrieve the current color attributes from the system and place the
  919.         current foreground color in ForeGround, the current background color
  920.         in BackGround, and the composite attribute in Composite. The
  921.         relationship is Composite = (BackGround * 16) + ForeGround. See
  922.         Appendix B for complete list of composite color attributes.
  923.  
  924.               Variable ForeColor,3
  925.               Variable BackColor,3
  926.               Variable ColorAttr,3
  927.               ?Color   ForeColor,BackColor,ColorAttr
  928.  
  929.         Retrieve the current foreground, background and composite color values
  930.         and place in the variables ForeColor, BackColor, and ColorAttr
  931.         respectively. To create professional programs it is a good idea to
  932.         retrieve the current color setting as the first command in the program
  933.         and reset these values and clear the screen at the end of your
  934.         program. This restores the users computer to the same color state that
  935.         you found when your PowerBatch program was executed.
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.                                         Page 14
  976.  
  977.  
  978.  
  979.  
  980.                           ?CURRDIR CurrDrive, CurrDirectory
  981.  
  982.         Retrieve the current drive and directory from the system and place the
  983.         current drive in CurrDrive and the current directory in CurrDirectory.
  984.         The contents of CurrDrive prior to execution of this command control
  985.         which drive is searched for the currently logged directory. If
  986.         ?CurrDir finds a valid drive letter in the first position of
  987.         CurrDrive, then the contents of CurrDirectory will be the currently
  988.         logged directory of that drive. If the first position of CurrDrive
  989.         does not contain a valid drive letter, then CurrDirectory will contain
  990.         the currently logged directory of the current drive. In either case
  991.         CurrDrive will contain the drive and CurrDirectory will contain the
  992.         directory.
  993.  
  994.            Variable    CurrDrive,2
  995.            Variable    CurrDir,79
  996.            SetVar      CurrDrive,"A"
  997.            ?CurrDir    CurrDrive,CurrDir
  998.            SetVar      CurrDrive,""
  999.            ?CurrDir    CurrDrive,CurrDir
  1000.  
  1001.         In the first usage of ?CurrDir, assuming that the currently logged
  1002.         directory on the A drive is the root directory, CurrDrive will contain
  1003.         "A" and CurrDir will contain "\" after the execution of ?CurrDir. In
  1004.         the second usage, assuming that the currently logged drive is D: and
  1005.         the currently logged directory on the D: drive is "\UTIL\EXEC",
  1006.         CurrDrive will contain "D" and CurrDir will contain "\UTIL\EXEC" after
  1007.         the execution of ?CurrDir.
  1008.  
  1009.                                  ====================
  1010.  
  1011.                           ?DATE DayOfWeek, Month, Day, Year
  1012.  
  1013.         Retrieve the current date from the system and place the day of the
  1014.         week in DayOfWeek, the month in Month, the day in Day, and the 4 digit
  1015.         year in Year. DayOfWeek should be defined as 9 long, Month and Day as
  1016.         2 long, and Year as 4 long.
  1017.  
  1018.            Variable DOW,9
  1019.            Variable Mo,2
  1020.            Variable Da,2
  1021.            Variable Yr,4
  1022.            ?Date DOW,Mo,Da,Yr
  1023.  
  1024.         Retrieve the current date and place the component parts in their
  1025.         respective variables. Place the day of the week in DOW (i.e.
  1026.         Saturday), the month number in Mo (i.e. 06), the day of the month in
  1027.         Da (i.e. 29), and the year in Yr (i.e. 1993).
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.                                         Page 15
  1040.  
  1041.  
  1042.  
  1043.  
  1044.         
  1045.                                        ====================
  1046.  
  1047.                       ?DIREXIST DirName, FoundLbl [,NotFoundLbl]
  1048.  
  1049.         Check the system for the existence of the directory whose name appears
  1050.         in DirName. If the directory exists go directly to the label FoundLbl,
  1051.         if the directory does not exist, go directly to the label NotFoundLbl.
  1052.         DirName may either be a variable or a literal. If NotFoundLbl is not
  1053.         specified, execution will continue with the next instruction
  1054.         immediately following the ?DirExist command.
  1055.  
  1056.            ?DirExist   InpStr,DirOk,BadDir
  1057.            ?DirExist   "C:\",DirOK,BadDir
  1058.            ?DirExist   InpStr,,BadDir  (next command if exists)
  1059.            ?DirExist   InpStr,DirOk    (next command if not exist)
  1060.  
  1061.         In the first example if the contents of the variable InpStr exists
  1062.         then goto label DirOK, if it does not exist go to the label BadDir. In
  1063.         the second example we check for the existence of a directory contained
  1064.         in the literal whose value is "C:\". In the third example, if the
  1065.         contents of InpStr exist we "fall through" to the next instruction, if
  1066.         the directory does not exist we jump to the label BadDir. In the
  1067.         fourth example, if the directory name in InpStr exists, we jump to the
  1068.         label DirOK, if it does not exist we fall through to the next command.
  1069.  
  1070.                                  ====================
  1071.  
  1072.                        ?DISKINFO DriveLetter, VolID, DriveType
  1073.  
  1074.         The volume ID is retrieved from the DriveLetter drive and the type of
  1075.         drive is determined and placed in DriveType. Volume ID may be a string
  1076.         of up to 12 characters. All disk media is not required to contain a
  1077.         Volume ID and in this case VolID will contain "No Label". The
  1078.         DriveType will be one of the following values:
  1079.            "360 Floppy"      "720 Floppy"      "1.2 Floppy"
  1080.            "1.4 Floppy"      "Other Floppy"    "Bernoulli"
  1081.            "HardDisk"        "RamDisk"         "SubDrive"
  1082.            "Unknown"         "Invalid"
  1083.  
  1084.            Variable Drive,1,'D'
  1085.            Variable VolumeID,12
  1086.            Variable DriveType,12
  1087.  
  1088.            ?DiskInfo   Drive,VolumeID,DriveType
  1089.            Compare  DriveType,'RamDisk',,,RamOK
  1090.            Write Drive
  1091.            WriteLine   ' is not a RAM drive!'
  1092.            Halt
  1093.  
  1094.            Label RamOK
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.                                         Page 16
  1105.  
  1106.  
  1107.  
  1108.  
  1109.         
  1110.                                        ====================
  1111.  
  1112.                     ?DISKSPACE DriveLetter, TotalSpace, FreeSpace
  1113.  
  1114.         Query the disk Drive specified by the first character of DriveLetter
  1115.         and place the total disk capacity in bytes in TotalSpace and the
  1116.         unused bytes in FreeSpace. Since the command looks at only the first
  1117.         character of DriveLetter, this parameter may contains strings such as
  1118.         "C:\UTIL". DriveLetter may be either a Variable or a Literal.
  1119.  
  1120.            Variable    DirName,79
  1121.            Write       'Enter your full pathname'
  1122.            ReadStr     DirName  (user enters "c:\util")
  1123.            ?DiskSpace  DirName,TotSpace,FreeSpace
  1124.  
  1125.         This will place the total capacity of drive C: in the variable
  1126.         TotSpace and the amount of this space that is unused in the variable
  1127.         FreeSpace.
  1128.  
  1129.            ?DiskSpace  "A",TotSpace,FreeSpace
  1130.  
  1131.         This retrieves the total capacity and free space for drive A:  using a
  1132.         literal of "A".
  1133.  
  1134.                                  ====================
  1135.  
  1136.                  ?DRIVEEXIST DriveLetter, ValidLabel [,InvalidLabel]
  1137.  
  1138.         Check the system for DriveLetter as a valid drive. If the drive is
  1139.         valid, jump to Label1, if the drive is not valid, jump to Label2. If
  1140.         InvalidLabel is not specified, execution will continue with the next
  1141.         command immediately following the ?DriveExist command. DriveLetter may
  1142.         be either a variable or a literal.
  1143.  
  1144.            ?DriveExist DrvNum,GoodDrv,BadDrv
  1145.            ?DriveExist "A",GoodDrv,BadDrv
  1146.            ?DriveExist DrvNum,,BadDrv (falls thru if drive ok)
  1147.            ?DriveExist DrvNum,GoodDrv (falls thru if drive bad)
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.                                         Page 17
  1170.  
  1171.  
  1172.  
  1173.  
  1174.         
  1175.                                        ====================
  1176.  
  1177.                        ?ENVSTR EnvironName, EnvironNameContents
  1178.  
  1179.         Retrieve the contents of any environment variable from the system
  1180.         environment area. The name of the environment variable is placed in
  1181.         EnvironName or entered as a literal and the contents of the
  1182.         environment variable will be placed in EnvironNameContents. Ensure
  1183.         that EnvironNameContents has been defined long enough to contain the
  1184.         contents of the environment variable. If EnvironNameContents is not
  1185.         long enough, the environment variable will be truncated. To display
  1186.         the currently defined environment variables, use the DOS "SET" command
  1187.         at a DOS prompt. (i.e. C:>SET <enter>) You should receive at least two
  1188.         environment variables (assuming you have set a path) with the format
  1189.         NAME=VALUE. The location of your command processor is in an
  1190.         environment variable named COMSPEC and should look something like
  1191.         this: COMSPEC=C:\COMMAND.COM.
  1192.  
  1193.            Variable    EnvValue,255
  1194.            Variable    EnvName,4,"path"
  1195.            ?EnvStr     "prompt", EnvValue
  1196.            ?EnvStr     EnvName, EnvValue
  1197.  
  1198.  
  1199.  
  1200.                                  ====================
  1201.  
  1202.                    ?FILEEXIST FileName, FoundLabel [,NotFoundLabel]
  1203.  
  1204.         Check the system for the specified file name. If the file exists, jump
  1205.         to the label FoundLabel, if the file does not exist, jump to the label
  1206.         NotFoundLabel. If NotFoundLabel is not entered, execution will
  1207.         continue with the next command immediately following the ?FileExist
  1208.         command. If only a file name is entered (i.e. CONFIG.SYS), then only
  1209.         the current directory will be searched. If a fully qualified filename
  1210.         is entered (i.e. C:\CONFIG.SYS), then only the specified directory
  1211.         will be searched. FileName may be either a variable or a literal. See
  1212.         ?FileExpand.
  1213.  
  1214.            ?FileExist  FileName, Label1, Label2
  1215.            ?FileExist  "C:\AUTOEXEC.BAT",StartOK,NoStart
  1216.            ?FileExist  FileName,,NotFound
  1217.            ?FileExist  FileName,Found
  1218.  
  1219.         The two commands ?FileExist and ?FileExpand are identical with the
  1220.         exception that ?FileExist gives you the capability to limit your
  1221.         search to the current directory while ?FileExpand will attempt to find
  1222.         the file anywhere on the disk and tell you exactly where the file was
  1223.         found.
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.                                         Page 18
  1235.  
  1236.  
  1237.  
  1238.  
  1239.         
  1240.                                        ====================
  1241.  
  1242.                   ?FILEEXPAND FileName, FoundLabel [,NotFoundLabel]
  1243.  
  1244.         Check the system for the specified file name. If the file exists, jump
  1245.         to the label FoundLabel, if the file does not exist, jump to the label
  1246.         NotFoundLabel. If NotFoundLabel is not entered, execution will
  1247.         continue with the next command immediately following the ?FileExist
  1248.         command. If FileName contains a drive and/or path in addition to the
  1249.         filename (i.e. C:\CONFIG.SYS or \CONFIG.SYS), the specified drive and
  1250.         directory is searched. If only a filename is placed in FileName, then
  1251.         the search contains the following: 1) the current directory, 2) the
  1252.         directory from which the compiled PowerBatch program was run, 3) all
  1253.         directories on the search path. (I try to find it in any directory on
  1254.         the disk which I know exists). If the file was found, the full path
  1255.         name\filename is placed in FileName. For this reason FileName must be
  1256.         a variable. Ensure that FileName is long enough to handle this full
  1257.         pathname!
  1258.  
  1259.            SetVar      FileName,'MYFILE.LTR'
  1260.            ?FileExpand FileName, Label1, Label2
  1261.  
  1262.         Assuming that MYFILE.DAT was located in "\WP60\LETTERS", the contents
  1263.         of FileName will be "C:\WP60\LETTERS\MYFILE.LTR".
  1264.  
  1265.            ?FileExpand "C:\AUTOEXEC.BAT",StartOK,NoStart
  1266.  
  1267.         ERROR! FileName cannot be a literal.
  1268.  
  1269.         The two commands ?FileExist and ?FileExpand are identical with the
  1270.         exception that ?FileExist gives you the capability to limit your
  1271.         search to the current directory while ?FileExpand will attempt to find
  1272.         the file anywhere on the disk and tell you exactly where the file was
  1273.         found.
  1274.  
  1275.                                  ====================
  1276.  
  1277.                              ?FILESIZE FileSize, FileName
  1278.  
  1279.         The size in bytes of FileName is placed in FileSize. FileName may be
  1280.         either a variable or a literal. FileSize must be a variable.
  1281.  
  1282.            Variable FileSize,11
  1283.            Variable FileName,'AUTOEXEC.BAT'
  1284.  
  1285.            CD    'C:\'       ;change drive and dir
  1286.            ?FileSize   FileSize, FileName   ;find the filesize
  1287.            ?FileSize   FileSize, 'AUTOEXEC.BAT' ;same results
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.                                         Page 19
  1300.  
  1301.  
  1302.  
  1303.  
  1304.         
  1305.                                        ====================
  1306.  
  1307.                     ?INPATH DirName, FoundLabel, [,NotFoundLabel]
  1308.  
  1309.         Compare the contents of DirName to the system search path. If DirName
  1310.         is contained within the path, jump to the label FoundLabel, if DirName
  1311.         is not contained within the path, jump to the label NotFoundLabel. If
  1312.         NotFoundLabel is not specified, execution will continue with the
  1313.         command immediately following the ?InPath command. Use this command to
  1314.         determine if a directory is located in the DOS search path.
  1315.  
  1316.            DOS search path contains "C:\UTIL;C:\WORDPROC;D:\"
  1317.            Variable    InString,79
  1318.            Write    "Enter your directory name "
  1319.            ReadStr     InString (user enters "c:\wordproc")
  1320.            Upper    InString (change to "C:\WORDPROC")
  1321.            ?InPath     InString,PathOK,BadPath
  1322.  
  1323.            ?InPath     "C:\UTIL",,BadPath   (compare literal)
  1324.  
  1325.                                  ====================
  1326.  
  1327.                                   ?TIME CurrentTime
  1328.  
  1329.         Retrieve the current time from the system and place in CurrentTime.
  1330.         The format of the time is hh:mm:ss xm. CurrentTime should be defined
  1331.         as 11 long.
  1332.  
  1333.            Variable CurrTime,11
  1334.            ?Time CurrTime (now contains 11:24:14 am)
  1335.  
  1336.                                  ====================
  1337.  
  1338.                                    ADD Sum, Number
  1339.  
  1340.         Add the contents of Number to Sum and place the result in Sum.
  1341.  
  1342.            Variable    YLoc,2
  1343.            SetVar      YLoc,6
  1344.            Label    LoopCtr
  1345.            ClearLine      YLoc,Blue
  1346.            Add         YLoc,1
  1347.            Compare     YLoc,11,LoopCtr
  1348.  
  1349.         This small code segment will clear lines 6 through 10 on your screen
  1350.         by incrementing the line number variable used by the ClearLine
  1351.         command.
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.                                         Page 20
  1365.  
  1366.  
  1367.  
  1368.  
  1369.         
  1370.                                        ====================
  1371.  
  1372.                           BEEP Frequency, Duration [,Repeat]
  1373.  
  1374.         Sound the system speaker with a tone of Frequency, for a length of
  1375.         Duration tenths of a second, and repeat Repeat times.
  1376.  
  1377.            Beep  800,5,3
  1378.            Beep  ErrFreq,BeepLen,ErrTimes
  1379.  
  1380.         The first example sounds the system speaker at a frequency of 800 hz
  1381.         for half a second (.5) and repeats twice for a total of 3 times. The
  1382.         second example will sound the system speaker at a frequency equal to
  1383.         the contents of the variable ErrFreq for BeepLen tenths of a second(s)
  1384.         for a total of ErrTimes.
  1385.  
  1386.                                  ====================
  1387.  
  1388.                                         BLINK
  1389.  
  1390.         Cause all text that is written to the screen to blink using the
  1391.         current color attributes last defined in the processing of the your
  1392.         program. This command in "undone" by using NORMAL.
  1393.  
  1394.            Variable MsgClear,25."                         "
  1395.            Blink
  1396.            WriteAt  15,4,"Not a valid entry"
  1397.            Normal
  1398.            Wait     35
  1399.            WriteAt  15,4,MsgClear
  1400.  
  1401.         Write the message "Not a valid entry" at column 15 on row 4 using the
  1402.         current color definition. Reset the text color to the value it
  1403.         contained before specifying blinking text. Wait 3.5 seconds and clear
  1404.         the message.
  1405.  
  1406.                                  ====================
  1407.  
  1408.                                          BOOT
  1409.  
  1410.         This command will cause the computer to perform a "warm" boot. This
  1411.         emulates the pressing of the Alt-Ctrl-Del key combination.
  1412.  
  1413.            ReadYN   'Press Y to REBOOT your machine (Y/N) ',YNInput
  1414.            Compare  YNInput,'Y',NoBoot,NoBoot
  1415.            Boot
  1416.            Label NoBoot
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.                                         Page 21
  1430.  
  1431.  
  1432.  
  1433.  
  1434.         
  1435.                                        ====================
  1436.  
  1437.                        BOXx UX, UY, LX, LY, ForeClr [,BackClr]
  1438.  
  1439.         Where Boxx is Box0 thru Box3. Draw a box (frame) on the screen whose
  1440.         upper left coordinates (X,Y) are UX,UY, and whose lower right
  1441.         coordinates (X,Y) are LX,LY. Draw the box using a line in foreground
  1442.         color ForeClr on background color BackClr. The border line for the box
  1443.         is:
  1444.            Box0 - No border
  1445.            Box1 - Single line
  1446.            Box2 - Double line
  1447.            Box3 - Heavy solid line.
  1448.         The interior of the box is cleared to the background color whether
  1449.         specified explicitly by the background color parameter or as a part of
  1450.         the composite color parameter. The cursor is positioned at UX+1, UY+1.
  1451.  
  1452.            Variable ULX,2,5     ;upper left col value
  1453.            Variable ULY,2,3     ;upper left row value
  1454.            Variable LRX,2,75    ;lower right col value
  1455.            Variable LRY,2,20    ;lower right row value
  1456.            Variable BoxFore,2,4 ;foreground color red
  1457.            Variable BoxBack,2,0 ;background color black
  1458.            Box1     ULX, ULY, LRX, LRY, BoxFore, BoxBack
  1459.            Box1     5,3,75,20,7,0
  1460.            Box1     5,3,75,20,112
  1461.  
  1462.         The first example draws a box whose upper left coordinates are the
  1463.         contents of the variables ULX and ULY and whose lower left coordinates
  1464.         are the contents of the variables LRX and LRY. The box border will be
  1465.         the contents of BoxFore (red) on a background of BoxBack (black).  The
  1466.         second example draws a box whose upper left coordinates are 5,3 and
  1467.         whose lower right coordinates are 75,20. The box border is drawn in
  1468.         white on black. The third example draws a box with the same
  1469.         coordinates and uses the composite color attribute of 112 (white on
  1470.         black). See ClearBox command.
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.                                         Page 22
  1495.  
  1496.  
  1497.  
  1498.  
  1499.         
  1500.                                        ====================
  1501.  
  1502.                  BOX4 UX, UY, LX, LY, ForeClr [,BackClr] [,ShadowClr]
  1503.  
  1504.         Draw a box (frame) on the screen whose upper left coordinates (X,Y)
  1505.         are UX,UY, and whose lower right coordinates (X,Y) are LX,LY. Draw the
  1506.         box using a line in foreground color ForeClr on background color
  1507.         BackClr. The border line for the box is single line with a transparent
  1508.         shadow. The shadow color is ShadowClr.
  1509.  
  1510.         The interior of the box is cleared to the background color whether
  1511.         specified explicitly by the background color parameter or as a part of
  1512.         the composite color parameter. The cursor is positioned at UX+1, UY+1.
  1513.  
  1514.            Variable ULX,2,5     ;upper left col value
  1515.            Variable ULY,2,3     ;upper left row value
  1516.            Variable LRX,2,75    ;lower right col value
  1517.            Variable LRY,2,20    ;lower right row value
  1518.            Variable BoxFore,2,4 ;foreground color red
  1519.            Variable BoxBack,2,0 ;background color black
  1520.            Variable Shadow,2,8  ;shadow color
  1521.            Box1     ULX,ULY,LRX,LRY,BoxFore,BoxBack,Shadow
  1522.  
  1523.  
  1524.         This example draws a box whose upper left coordinates are the contents
  1525.         of the variables ULX and ULY and whose lower left coordinates are the
  1526.         contents of the variables LRX and LRY. The box border will be the
  1527.         contents of BoxFore (red) on a background of BoxBack (black). The
  1528.         shadow color is the contents of the variable Shadow. See ClearBox
  1529.         command.
  1530.  
  1531.                                  ====================
  1532.  
  1533.                                        BREAKON
  1534.  
  1535.  
  1536.         Provides a capability to exit from a PowerBatch program by pressing
  1537.         the combination of keys (Ctrl - Break) or (Ctrl - C). The default
  1538.         value set at the beginning of any PowerBatch program is BreakON. To
  1539.         keep a user from exiting a running PowerBatch program, execute the
  1540.         BreakOFF command. If sections of the program are to be protected and
  1541.         other sections not protected, surround the sections with pairs of
  1542.         BreakON...BreakOFF commands. See BreakOff command.
  1543.  
  1544.                                  ====================
  1545.  
  1546.                                        BREAKOFF
  1547.  
  1548.         Disables the ability to stop a PowerBatch program by pressing the
  1549.         (Ctrl - Break) or (Ctrl - C) key combinations. The default value set
  1550.         at the beginning of any PowerBatch program is BreakON. See BreakOn
  1551.         command.
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.                                         Page 23
  1560.  
  1561.  
  1562.  
  1563.  
  1564.         
  1565.                                        ====================
  1566.  
  1567.                              CENTER TextToCenter, LineNum
  1568.  
  1569.         TextToCenter is centered on LineNum. If LineNum is omitted, the
  1570.         current line is assumed. If imbedded color commands are present in
  1571.         TextToCenter, they are processed.
  1572.  
  1573.            Variable InpStr,25,"PowerBatch"
  1574.            Variable MenuLine,19,"@004M@007enu Line 1"
  1575.            Center   "PowerBatch",2
  1576.            Center   InpStr,2
  1577.            Center   MenuLine,14
  1578.  
  1579.         Both of the first two examples will center the text "PowerBatch" on
  1580.         line 2. The third example will center the text "Menu Line 1" on line
  1581.         14. The value of the variable MenuLine contains imbedded colors
  1582.         commands. Note that the character,"@" is used to signify ASCII 001, a
  1583.         non-printable character. Refer to the notes on imbedded color
  1584.         commands.
  1585.  
  1586.                                  ====================
  1587.  
  1588.                                     CHDIR DirName
  1589.  
  1590.         DirName is made to be the current directory. If DirName contains a
  1591.         drive designation (i.e. C:\NEWDIR), a change will be made to the new
  1592.         drive prior to changing to the new directory.
  1593.  
  1594.            Variable Drive,3
  1595.            Variable Directory,79
  1596.            Write 'Enter new drive letter >'
  1597.            ReadKey  Drive
  1598.            Concat   Drive,':\'
  1599.            Write 'Enter new directory >'
  1600.            ReadStr  Directory
  1601.            Concat   Directory,Drive,Directory
  1602.            ChDir Directory
  1603.  
  1604.         The user is asked to enter a new drive and a new directory. These are
  1605.         then concatenated into the variable Directory. If the resulting value
  1606.         in Directory is "C:\NEWDIR", the ChDir command will change the logged
  1607.         (current default) drive to "C" and the logged directory to "\NEWDIR".
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.                                         Page 24
  1625.  
  1626.  
  1627.  
  1628.  
  1629.         
  1630.                                        ====================
  1631.  
  1632.                  CLEAR FGrndClr, [,BGrndClr] [,ClearChar] [BorderClr]
  1633.  
  1634.         The current defined screen will be cleared. This may have been altered
  1635.         with a Window command, if so, only the defined window will be cleared.
  1636.         The screen will be cleared to FGrndClr, BGrndClr. If ClearChar is
  1637.         specified, the screen will be cleared to this character, else it will
  1638.         be cleared to spaces. If the current defined screen is 1,1,80,25; the
  1639.         border will be set to BorderClr. The border may be "cleared" to normal
  1640.         with a clear command with BorderClr set to black.
  1641.  
  1642.            Variable ColorAttr,3,112 ;define wht on black
  1643.            Clear ColorAttr         ;clear to composite color 112
  1644.            Clear 7,0,'â–‘'           ;clear to white on black using
  1645.                                 ; the char â–‘ to create a
  1646.                                    ; pattern
  1647.            Clear 4,0,,4            ;clear to red on black with
  1648.                                    ; red border, no pattern
  1649.  
  1650.  
  1651.                                  ====================
  1652.  
  1653.                   CLEARBOX UX,XY,LX,LY, FgClr, [BkgClr] [,ClearChar]
  1654.  
  1655.  
  1656.         Clear the interior of the box whose upper left coordinates (X,Y) are
  1657.         UX,UY and whose lower right coordinates (X,Y) are LX,LY. Clear the
  1658.         interior of the box to foreground color FgClr and background color
  1659.         BkgClr. This command clears the "inside" of the box, not the lines
  1660.         which describe the box. If ClearChar is specified, the interior of the
  1661.         box is propagated with the clear character.
  1662.  
  1663.            Variable ULX,2,5     ;upper left col value
  1664.            Variable ULY,2,3     ;upper left row value
  1665.            Variable LRX,2,75    ;lower right col value
  1666.            Variable LRY,2,20    ;lower right row value
  1667.            Variable BoxFore,2,4 ;foreground color red
  1668.            Variable BoxBack,2,0 ;background color black
  1669.            Box1     ULX, ULY, LRX, LRY, BoxFore, BoxBack
  1670.            ClearBox 5,3,75,20,112
  1671.  
  1672.         In this example we define the upper right and lower left coordinates
  1673.         of the box as well as the colors BoxFore and BoxBack. We draw the box
  1674.         with a red line on a black background. The ClearBox command clears the
  1675.         interior of the box to white on black.
  1676.  
  1677.            ClearBox ULX,ULY,LRX,LRY,BoxFore,BoxBack,'â–“'
  1678.  
  1679.         This command clears the box to red on black and completely fills the
  1680.         box with the character "â–“".
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.                                         Page 25
  1690.  
  1691.  
  1692.  
  1693.  
  1694.         
  1695.                                        ====================
  1696.  
  1697.                     CLEARLINE LineNum, ForeGrndClr [,BackGrndClr]
  1698.  
  1699.         Clear the line number specified by LineNum to a foreground color of
  1700.         ForeGrndClr and a background color of BackGrndClr. The line number is
  1701.         relative to the top of the current window. If you have defined a
  1702.         window with one of the PowerBatch window commands, the ClearLine
  1703.         command will be relative to the top left of this current window.
  1704.  
  1705.            Variable    Red,1,4
  1706.            Variable    Blue,1,1
  1707.            Variable    RedOnBlue,2,20
  1708.            Variable    CurrLine,2,12
  1709.            ClearLine      12,Red,Blue
  1710.            ClearLine      CurrLine,RedOnBlue
  1711.  
  1712.         Both examples of the ClearLine command clear line 12 on the screen to
  1713.         red foreground color and blue background color.
  1714.  
  1715.            Window1     20,5,60,10,32
  1716.            ClearLine      3,26
  1717.  
  1718.         This command will clear the third line of the defined window (the
  1719.         eighth absolute line on the physical screen), i.e. the third line down
  1720.         from the top of the window.
  1721.  
  1722.                                  ====================
  1723.  
  1724.                          COLOR ForeGroundClr [,BackgroundClr]
  1725.  
  1726.         Set the default system color to a foreground color of ForeGroundClr
  1727.         and to a background color of BackgroundClr or optionally set the
  1728.         system color to the composite color attribute ForeGroundClr.
  1729.  
  1730.            Variable RedOnBlue,2,20
  1731.            Color 4,1
  1732.            Color MenuClr
  1733.  
  1734.         Both examples set the default color to red on blue for any text
  1735.         written to the screen without specific color instructions.
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.                                         Page 26
  1755.  
  1756.  
  1757.  
  1758.  
  1759.         
  1760.                                        ====================
  1761.  
  1762.                      COMPARE Value1, Value2, 1GR2,  1Less2, 1EQ2
  1763.  
  1764.         Compare the contents of Value1 to the contents of Value2. If Value1 is
  1765.         greater than Value2 jump to the Label 1GR2. If Value1 is less than
  1766.         Value2 jump to the label 1Less2. If Value1 is equal Value2 jump to the
  1767.         label 1EQ2. If the contents of the first two operands (Value1, Value2)
  1768.         are numeric then a numeric compare is performed otherwise an
  1769.         alphabetic compare is made. (If 19 is compared alphabetically to 2,
  1770.         then 2 is greater than 19; if it is compared numerically, 19 is
  1771.         greater than 2.)
  1772.  
  1773.            Variable InChar,1
  1774.            Variable Yes,1,"Y"
  1775.            Variable No,1,"N"
  1776.            GoToXY   4,23
  1777.            ReadYN   "Incorrect entry...Continue [Y/N] "
  1778.            Compare  InChar,"Y",NoIn,NoIn,YesIn
  1779.            Compare  InChar,Yes,,,YesIn   (Not Y falls through)
  1780.            Compare  InChar,"Y",NoIn,NoIn (Y falls through)
  1781.  
  1782.         In the first example, variable InChar is compared to literal "Y". If
  1783.         InChar is greater than "Y" then the program will jump to the label
  1784.         NoIn; if InChar is less than "Y", the program also jumps to the label
  1785.         NoIn; if InChar is equal to "Y", the program will continue processing
  1786.         at the label named YesIn. In the second compare, the variable InChar
  1787.         is compared to the variable Yes which has an assigned value of "Y". If
  1788.         InChar contains anything but "Y", the program continues with the next
  1789.         instruction after the compare command (it is said to fall through); if
  1790.         InChar contains "Y", the program will jump to the label YesIn. In the
  1791.         third compare command, variable InChar is compared to the literal "Y".
  1792.         If the variable InChar contains "N" (ReadYN prevents any entry but Y
  1793.         or N) the program jumps to the label NoIn otherwise it continues with
  1794.         the instruction after the compare command.
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.                                         Page 27
  1820.  
  1821.  
  1822.  
  1823.  
  1824.         
  1825.                                        ====================
  1826.  
  1827.                           CONCAT Target, String1 [,String2]
  1828.  
  1829.         If String2 is omitted, String1 is appended to Target. If String2 is
  1830.         present, String2 is appended to String1 and the result replaces
  1831.         Target.
  1832.  
  1833.            Variable    OutMsg,78
  1834.            Variable    ErrMsg," is not a valid Drive letter."
  1835.            Variable    DriveLtr,1
  1836.            WriteAt     6,17,"Enter your source drive letter "
  1837.            ReadUpKey      DriveLtr
  1838.            ?DriveExist DriveLtr,DriveOK
  1839.            Concat      OutMsg, "[19] ", DriveLtr
  1840.            Concat      OutMsg, " is not a valid Drive letter."
  1841.            WriteAt     5,23,OutMsg
  1842.  
  1843.         In this example we ask the user to input a valid drive letter and
  1844.         verify this drive with the ?DriveExist command. If the drive is not
  1845.         valid we concatenate "[19]" (the error number) plus the drive letter
  1846.         entered by the user into the variable OutMsg. We then concatenate the
  1847.         error message (" is not a valid Drive letter.") onto the contents of
  1848.         OutMsg. The result would be something like "[19] L is not a valid
  1849.         Drive letter."
  1850.  
  1851.                                  ====================
  1852.  
  1853.                                   CURSOR CursorType
  1854.  
  1855.         CursorType may be 1,2, 3 or 4. 1 = normal cursor; 2 = cursor off; 3 =
  1856.         fat cursor; 4 = block cursor. A "fat" cursor is the cursor shape
  1857.         normally seen when text is to be inserted. The block cursor fills the
  1858.         entire screen position. Remember to set the cursor back to normal at
  1859.         the end of a program if you have set the cursor off during the
  1860.         processing of your program. This is not automatically set back to
  1861.         normal when the program terminates.
  1862.  
  1863.            Variable Normal,1,1
  1864.            Variable Off,1,2
  1865.            Variable Fat,1,3
  1866.            Variable Block,1,4
  1867.  
  1868.            Cursor   Off
  1869.            Cursor   2
  1870.            Cursor   Fat,1
  1871.            Cursor   3
  1872.            Cursor   Block
  1873.            Cursor   4
  1874.            Cursor   Normal
  1875.            Cursor   1
  1876.  
  1877.         Each preceding pair of commands will have the same results. Off has a
  1878.         value of 2, Fat has a value of 3, etc.
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.                                         Page 28
  1885.  
  1886.  
  1887.  
  1888.  
  1889.         
  1890.                                        ====================
  1891.  
  1892.                          DIVIDE Result, Divisor [,Remainder]
  1893.  
  1894.         If the divisor is less than 1 then Result is set to zero. Result is
  1895.         divided by Divisor (integer division) and the result of the division
  1896.         is placed in Result. Any Remainder from the division is placed in
  1897.         Remainder if this parameter is specified.
  1898.  
  1899.            Variable Result,11
  1900.            Variable Remainder,3
  1901.            Variable Integer1,11,25
  1902.            Variable Integer2,11,84
  1903.  
  1904.            SetVar   Result,17
  1905.            Divide   Result,3,Remainder
  1906.  
  1907.         Divide 17 by 3 and place any remainder in Remainder. After division,
  1908.         Result will contain 5 and Remainder will contain 2.
  1909.  
  1910.            Subtract Integer1,Integer2
  1911.            Divide   Result,Integer1
  1912.  
  1913.         The result of the subtraction of Integer2 from Integer1 is -59.
  1914.         Division by a negative number is not allowed and the Result will be
  1915.         set to 0.
  1916.  
  1917.                                  ====================
  1918.  
  1919.                                        FLUSHKEY
  1920.  
  1921.         Removes all characters from the system keyboard buffer. After
  1922.         execution of this command, there will be no more characters waiting to
  1923.         be retrieved from the keyboard buffer. Use this command to eliminate
  1924.         the possibility of any "type ahead" characters being present in the
  1925.         buffer when you ask for input from the user.
  1926.  
  1927.            WriteLine   'CAUTION, You will now format your hard disk'
  1928.            FlushKey
  1929.            ReadYN      'Format hard Disk (Y/N)? ',InputChar
  1930.  
  1931.                                  ====================
  1932.  
  1933.                                      GOTO Label1
  1934.  
  1935.         Jump to the statement identified as command label Label1. Program
  1936.         processing will go directly from this GoTo command to Label1 and
  1937.         continue with the command immediately following the label (since the
  1938.         label command is simply a placemarker).
  1939.  
  1940.            GoTo     Error
  1941.            GoTo  EndOfPgm
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.                                         Page 29
  1950.  
  1951.  
  1952.  
  1953.  
  1954.         
  1955.                                        ====================
  1956.  
  1957.                                GOTOXY XCo-ord, YCo-ord
  1958.  
  1959.         Move the cursor to the column (X) specified in XCo-ord and row (Y)
  1960.         specified in YCo-ord.
  1961.  
  1962.            Variable CurrX,2
  1963.            Variable CurrY,2
  1964.            GoToXY   CurrX, CurrY
  1965.            GoToXY   12,6
  1966.  
  1967.         In the first example the cursor is moved to the location specified by
  1968.         the contents of variable CurrX and CurrY. In the second example, the
  1969.         cursor is moved to the location specified by two literals "12" and
  1970.         "6".
  1971.  
  1972.                                  ====================
  1973.  
  1974.                                   HALT [ErrorLevel]
  1975.  
  1976.         Halt your PowerBatch program and set DOS errorlevel to ErrorLevel.
  1977.  
  1978.            Variable Error14,2,14   ;define Error14 as "14"
  1979.            Halt     99
  1980.            Halt     Error14
  1981.  
  1982.         In the first usage of the Halt command, the PowerBatch program is
  1983.         halted and the DOS errorlevel is set to 99. In the second usage the
  1984.         program is halted and the DOS errorlevel is set to the contents of
  1985.         variable Error14 ("14").
  1986.  
  1987.                                  ====================
  1988.  
  1989.                                    LABEL LabelName
  1990.  
  1991.         Define a location in your source that will enable execution to begin
  1992.         immediately following the Label command without necessarily having
  1993.         executed the command immediately prior to the label. Jump immediately
  1994.         to this location in the command stream. See the discussion on labels
  1995.         at the beginning of this section.
  1996.  
  1997.            Label    MatchErr
  1998.            Label    EndOfPgm
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.                                         Page 30
  2015.  
  2016.  
  2017.  
  2018.  
  2019.         
  2020.                                        ====================
  2021.  
  2022.                              LENGTH StringLength, String
  2023.  
  2024.         Calculate the length of the string in variable String and place the
  2025.         result in StringLength.
  2026.  
  2027.            Variable InString
  2028.            Variable StrLen
  2029.  
  2030.            WriteAt  12,14,"Enter your current directory "
  2031.            ReadStr  InString
  2032.  
  2033.         User enters c:\util.
  2034.  
  2035.            Length   StrLen, InString
  2036.  
  2037.         StrLen will contain 7, the length of "c:\util".
  2038.  
  2039.                                  ====================
  2040.  
  2041.                                      LOWER String
  2042.  
  2043.         Change the alphabetic characters in the variable String to lower case.
  2044.  
  2045.            Variable InString,25
  2046.            ReadStr  InString
  2047.  
  2048.         User enters C:\UTIL.
  2049.  
  2050.            Lower InString
  2051.  
  2052.         Now contains c:\util.
  2053.  
  2054.                                  ====================
  2055.  
  2056.                     MIDSTRING NewString, OldString, Offset, Length
  2057.  
  2058.         Create a NewString by extracting characters from OldString. Beginning
  2059.         with the Offset character of OldString, extract Length characters and
  2060.         create the new string.
  2061.  
  2062.            Variable Path,79
  2063.            WriteAt  1,2,"Enter Drive and Directory name "
  2064.            ReadStr  Path
  2065.  
  2066.         User enters C:\UTIL.
  2067.  
  2068.            MidString   Drive,Path,1,2
  2069.  
  2070.         Extract C: from C:\UTIL, making the newstring C:.
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.                                         Page 31
  2080.  
  2081.  
  2082.  
  2083.  
  2084.         
  2085.                                        ====================
  2086.  
  2087.                                MULTIPLY Result, Number
  2088.  
  2089.         Result is multiplied by Number and the result of the multiplication is
  2090.         placed in Result.
  2091.  
  2092.            Variable Total,11
  2093.            Variable Units,4
  2094.            Variable Quantity,3
  2095.  
  2096.            SetVar   Total,Units
  2097.            Multiply Total,Quantity
  2098.            Write 'Your total quantity is '
  2099.            WriteLine   Total
  2100.  
  2101.                                  ====================
  2102.  
  2103.                                         NORMAL
  2104.  
  2105.         Change the current color attribute(s) back to the definition prior to
  2106.         the execution of a BLINK or REVERSE command.
  2107.  
  2108.            Color 20    ;set default color to red on blue
  2109.            Blink       ;changes to blinking red on blue
  2110.            WriteAt  2,24,"Incorrect...re-enter!"
  2111.            Normal         ;resets color to 20
  2112.            Beep     800,8
  2113.            Wait     35    ;pause 3.5 seconds
  2114.            WriteAt  2,24,"                    "   ;clear msg
  2115.  
  2116.         This is an example of a typical error routine. The color attribute is
  2117.         changed to blinking with the Blink command. The error message is
  2118.         written and the color attribute is changed back to its original value
  2119.         with the Normal command. The speaker is "beeped" and after a wait of
  2120.         3.5 seconds, the error message is removed from the screen.
  2121.  
  2122.                                  ====================
  2123.  
  2124.                                        PRINTSCR
  2125.  
  2126.         The entire contents of the current screen is sent to the system
  2127.         printer. A page eject is automatically appended to the last character
  2128.         to cause the printer to eject the printed page.
  2129.  
  2130.                                  ====================
  2131.  
  2132.                                  PROMPT NewPromptVal
  2133.  
  2134.         Change the current value of the prompt to the value specified in
  2135.         NewPromptVal.
  2136.  
  2137.            Prompt   "$P$G"
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.                                         Page 32
  2145.  
  2146.  
  2147.  
  2148.  
  2149.         
  2150.                                        ====================
  2151.  
  2152.                               RANDOM UpperLimit, Result
  2153.  
  2154.         A random number is generated from (and including) zero through the
  2155.         UpperLimit. The random number is placed in Result.
  2156.  
  2157.            Variable RandNum,3
  2158.  
  2159.            Random   200,RandNum
  2160.  
  2161.         A random number between 0 and 200 inclusive will be generated.
  2162.  
  2163.            Label NewNumb
  2164.            Random   200,RandNum
  2165.            Compare  RandNum,100,,NewNumb
  2166.  
  2167.         This will generate a random number between 100 and 200.
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.                                         Page 33
  2210.  
  2211.  
  2212.  
  2213.  
  2214.         
  2215.                                        ====================
  2216.  
  2217.                READKEY Target [,SpecInd] [,Tmeout] [,NoPrt] [,CtlChar]
  2218.  
  2219.         Read a single key from the keyboard and place the result in Target. If
  2220.         SpecInd contains a "1" after reading the key from the keyboard, then a
  2221.         "special key" has been returned in Target. Special keys are function
  2222.         keys, Page Up/Down, cursor movement keys, etc. If you are in doubt
  2223.         about a particular key, run the program "KEYID" (furnished on the
  2224.         install disk). Each key you press will be identified as either a
  2225.         regular key or a special key and the value that will be returned in
  2226.         Target when this key is pressed (remember that SpecInd will contain a
  2227.         "1" for special keys).
  2228.  
  2229.          The TmeOut parameter is used when you want to wait for a key from the
  2230.         keyboard, but continue processing without receiving the key after a
  2231.         specified number of seconds. Placing the number of seconds to wait in
  2232.         TmeOut will allow your program to "fall through" the ReadKey
  2233.         instruction if the timeout value is exceeded. If no input is received
  2234.         within TmeOut seconds, the null character (ASCII 0) is placed in
  2235.         Target and zero is placed in SpecInd.
  2236.  
  2237.         The NoPrt parameter gives you the option to have the entered character
  2238.         printed or not. The default is to print the character. If you wish to
  2239.         have the character not printed to the screen, place a one (1) in the
  2240.         NoPrt parameter.
  2241.  
  2242.         ReadKey gives you the capability to check for Non-ASCII keys (i.e.
  2243.         NumLock, Scroll Lock, etc.). Place one of the characters from the
  2244.         following table in the CtlChar parameter. If the requested key is
  2245.         pressed on the keyboard (or toggled on in the case of NumLock, Scroll
  2246.         Lock, and Caps Lock), ReadKey will return with SpecInd set to 2. No
  2247.         key will be returned in Target. Select one of these values to be
  2248.         placed in CtlChar:
  2249.            Right Shift #1       Left Shift     #2
  2250.            Ctrl        #4       Alt            #8
  2251.            Scroll Lock #16      Num Lock       #32
  2252.            Caps Lock   #64      Insert         #128
  2253.  
  2254.            Variable InKey,1
  2255.            Variable Spec,1
  2256.            Variable F10,1,#68
  2257.            Variable Caps,1,#64
  2258.  
  2259.            ReadKey  InKey                ;read a single key
  2260.  
  2261.            ReadKey  InKey,Spec
  2262.            Compare  Spec,1,Reg,Reg       ;fall thru if Spec=1
  2263.            Compare  InKey,F10,NotF10,NotF10 ;fall thru if F10
  2264.  
  2265.            ReadKey  InKey,Spec,10        ;wait 10 secs
  2266.            Compare  InKey,'',,,NoKey     ;InKey=null, timedout
  2267.  
  2268.            ReadKey  InKey,,,1            ;dont print the input
  2269.  
  2270.            ReadKey  InKey,Spec,,,Caps
  2271.            Compare  Spec,2,,,CapsOn      ;Spec=2, caps lock on
  2272.            Write 'Caps Lock is off'
  2273.  
  2274.                                         Page 34
  2275.  
  2276.  
  2277.  
  2278.  
  2279.         
  2280.                                        ====================
  2281.  
  2282.                               READSTR Target [,TimeOut]
  2283.  
  2284.         Read a string of characters from the keyboard until the user presses
  2285.         the enter key. Any number of characters may be read up to the maximum
  2286.         length specified for Target in the Variable statement. If the TimeOut
  2287.         parameter is specified, wait the specified number of seconds before
  2288.         continuing without having received a key.
  2289.  
  2290.            Variable InString,12
  2291.            ReadStr  InString    ;12 chars max will be read
  2292.  
  2293.            Label ReadPass
  2294.            ReadStr  InString,10 ;Only wait 10 secs for input
  2295.            Compare  InString,'',InputOK
  2296.            WriteAt  12,24,'Please enter your password'
  2297.            GoTo     ReadPass
  2298.  
  2299.            Label InputOK
  2300.  
  2301.                                  ====================
  2302.  
  2303.                              READUPKEY Target [,TimeOut]
  2304.  
  2305.         Read a single character from the keyboard, changing the case of any
  2306.         alphabetic character to upper case and place this upper case character
  2307.         in Target. If the TimeOut parameter is present, continue with the
  2308.         execution of the program after TimeOut seconds even if no character is
  2309.         entered.
  2310.  
  2311.            ReadUpKey      CharIn      ;read a single char in upper case
  2312.  
  2313.            WriteAt        16,24,'Enter your drive letter'
  2314.            ReadUpKey      CharIn,10   ;wait 10 seconds for a key
  2315.            Compare        CharIn,'',GotDrive,GotDrive
  2316.            SetVar         CharIn,'C'  ;supply default drive letter
  2317.  
  2318.            Label GotDrive
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.                                         Page 35
  2340.  
  2341.  
  2342.  
  2343.  
  2344.         
  2345.                                        ====================
  2346.  
  2347.                      READYN Message, Target [,TimeOut][,NoPrint]
  2348.  
  2349.         Write the message found in Message at the current cursor location and
  2350.         wait for a single key to be entered from the keyboard. Force the user
  2351.         to enter either a "Y" or "N" and place the upper case "Y" or "N" in
  2352.         Target. If TimeOut is specified, wait only the specified number of
  2353.         seconds before continuing with the program without input. If the
  2354.         character entered is not to be printed, place a one (1) in NoPrint.
  2355.  
  2356.            Variable Msg4,35,"Invalid name...Continue [Y/N] "
  2357.            ReadYN   "Invalid name...Continue [Y/N] ",CharIn
  2358.  
  2359.            ReadYN   Msg4,CharIn
  2360.  
  2361.         In both usages of the ReadYN command, the message "Invalid
  2362.         filename...Continue [Y/N] " will be displayed and the program will
  2363.         wait for a response from the user. If the user enters any characters
  2364.         other than "Y", "y", "N", or "n" the system speaker will sound and the
  2365.         user is prompted again for input. At the completion of this command,
  2366.         the variable CharIn will contain either "Y" or "N" (always upper
  2367.         case).
  2368.  
  2369.            Label ErrMsg
  2370.            ReadYN   Msg4,CharIn,8
  2371.            Compare  CharIn,'',GotChar
  2372.            Beep     800,8
  2373.            GoTo     ErrMsg
  2374.  
  2375.         If the user does not enter a character within 8 seconds, the system
  2376.         speaker will be sounded and the user asked again for input.
  2377.  
  2378.                                  ====================
  2379.  
  2380.                                        REVERSE
  2381.  
  2382.         Change the text attributes to "reverse video". This is accomplished by
  2383.         swapping the foreground and background attributes. This command is
  2384.         "undone" by using NORMAL.
  2385.  
  2386.            Color 20    ;red on black
  2387.            Reverse        ;color is changed to black on red
  2388.            WriteAt  1,15,"Press Escape To Continue"
  2389.            Normal         ;color is now red on black
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.                                         Page 36
  2405.  
  2406.  
  2407.  
  2408.  
  2409.         
  2410.                                        ====================
  2411.  
  2412.                                      SCRMODE Mode
  2413.  
  2414.         Used for changing the screen mode to 43/50 lines per screen on
  2415.         monitors that have the capability to display in these modes. The mode
  2416.         shift will automatically detect either 43 or 50 lines and change to
  2417.         the proper mode. Mode 0 will switch from 43/50 to 25 lines per screen.
  2418.         Mode 1 will switch from 25 lines to 43/50 lines per screen.
  2419.  
  2420.            Variable 25Lines,1,0 ;define a var with value 0
  2421.            Variable 43Lines,1,1 ;define a var with value 1
  2422.  
  2423.            Mode     43Lines
  2424.            Perform  DisplayParms   ;display a file
  2425.            Mode     25Lines     ;return to normal screen display
  2426.  
  2427.                                  ====================
  2428.  
  2429.                            SETENV EnvironName EnvironValue
  2430.  
  2431.         The environment variable named EnvironName will have its value changed
  2432.         to EnvironValue. Error messages will occur if the size of the new
  2433.         value minus the size of the old value is greater than the number of
  2434.         free bytes of environment space available.
  2435.  
  2436.            Variable    VarName,7,"MONITOR"
  2437.            Variable VarValue,5,"color"
  2438.  
  2439.            SetEnv   VarName, VarValue
  2440.            SetEnv   "Monitor","color"
  2441.  
  2442.         Both examples will change the environment variable "Monitor" to have a
  2443.         value of "color".
  2444.  
  2445.                                  ====================
  2446.  
  2447.                                    SETPATH NewPath
  2448.  
  2449.         The current PATH environment variable will have its value changed to
  2450.         NewPath. Error messages will occur if the size of the new path value
  2451.         minus the size of the old value is greater than the number of free
  2452.         bytes of environment space available.
  2453.  
  2454.            Variable NewPath,40,"d:\;c:\util\exec;c:\wp\letters"
  2455.  
  2456.            SetPath  NewPath
  2457.            SetPath  "d:\;c:\;"
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.                                         Page 37
  2470.  
  2471.  
  2472.  
  2473.  
  2474.         
  2475.                                        ====================
  2476.  
  2477.                               SETVAR VariableName, Value
  2478.  
  2479.         Set the value of VariableName to the contents of Value. A variable
  2480.         cannot be set to a value greater in length than the  maximum length
  2481.         parameter in the Variable definition.
  2482.  
  2483.            Variable ErrCode,3
  2484.            Variable FileName,79
  2485.  
  2486.            SetVar   ErrCode,99
  2487.            SetVar   FileName,"C:\CONFIG.SYS"
  2488.  
  2489.         In the first usage of the SetVar command, the variable ErrCode is set
  2490.         to "99" and the second usage sets the variable FileName to
  2491.         "C:\CONFIG.SYS".
  2492.  
  2493.                                  ====================
  2494.  
  2495.                                 SUBTRACT Total, Number
  2496.  
  2497.         Subtract the contents of Number from the contents of Total and place
  2498.         the result in Total.
  2499.  
  2500.            Variable TotalLines,2,25
  2501.  
  2502.            Subtract TotalLines,1
  2503.  
  2504.         Subtract the constant "1" from the variable "TotalLines" and place the
  2505.         result in TotalLines.
  2506.  
  2507.                                  ====================
  2508.  
  2509.                                   UPPER VariableName
  2510.  
  2511.         Change all the alphabetic characters in VariableName to upper case.
  2512.  
  2513.            Variable InString,25
  2514.            WriteAt  14,25,"Enter your directory name "
  2515.            ReadStr  InString          (user enters c:\util)
  2516.            Upper    InString          (changed to C:\UTIL)
  2517.            ?InPath  InString,GoodDir  (path is always upper case)
  2518.  
  2519.         In this example, the user is prompted for a path name to be entered.
  2520.         The path name is to be compared to the system path for validity. Since
  2521.         the contents of the system path are always in upper case, we change
  2522.         the InString variable to upper case prior to comparison.
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.                                         Page 38
  2535.  
  2536.  
  2537.  
  2538.  
  2539.         
  2540.                                        ====================
  2541.  
  2542.                    VARIABLE VariableName, MaxLength [,InitialValue]
  2543.  
  2544.         Define a variable to be used in a PowerBatch program. The variable
  2545.         will have a maximum length of MaxLength and an initial value of
  2546.         InitialValue. The initial value may be either an alphabetic value, a
  2547.         numeric value, or an ASCII value. An initial value which is alphabetic
  2548.         must be enclosed in either single or double quotes. A numeric initial
  2549.         value may be defined with or without quote delimiters but a convention
  2550.         of no quotes is a recommended technique. An  ASCII value is expressed
  2551.         as #nnn where nnn is the decimal value of the ASCII character. A
  2552.         variable may be of any length from 1 through 255. The initial value
  2553.         may be of any length from 1 through the MaxLength. VariableName is the
  2554.         name which you give to this variable and the means by which you refer
  2555.         to the variable in other PowerBatch commands.  See the discussion on
  2556.         variables at the beginning of this section.
  2557.  
  2558.         The special variables CLP%1 - CLP%16 are used to receive Command line
  2559.         parameters passed to a compiled PowerBatch program. Any command line
  2560.         parameters will be found in these  special parameters only.  Any
  2561.         number of parameters up to the max of 16 may be passed.
  2562.  
  2563.         Define a variable with no initial value.
  2564.            Variable DayOfWeek,9
  2565.  
  2566.         Define an alpha variable with an initial value.
  2567.            Variable ErrMsg1,25,"Invalid directory name."
  2568.  
  2569.         Define a variable with an initial numeric value of 50.
  2570.            Variable PauseTime,2,50
  2571.  
  2572.         Define a variable as a single ASCII value.
  2573.            Variable RightArrow,1,#26
  2574.  
  2575.         Define a variable as a string of ASCII values.
  2576.            Variable DblLine,5,#205#205#205#205#205
  2577.  
  2578.         Define a variable to receive a command line parameter.
  2579.            Variable CLP%1,12
  2580.  
  2581.                                  ====================
  2582.  
  2583.                                    WAIT TimeToWait
  2584.  
  2585.         Cause the execution of a PowerBatch program to pause for a specified
  2586.         amount of time. TimeToWait is expressed in tenths of a second.
  2587.  
  2588.            Variable PauseTime,2,50
  2589.            Wait     5           (pause half a second)
  2590.            Wait     PauseTime   (pause 5 seconds)
  2591.            Wait     35          (pause 3.5 seconds)
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.                                         Page 39
  2600.  
  2601.  
  2602.  
  2603.  
  2604.         
  2605.                                        ====================
  2606.  
  2607.                  WINDOW0-3 UpX,UpY,LoX,LoY,FGClr [,BKClr]
  2608.                   WINDOW4 UpX,UpY,LoX,LoY,FGClr [,BKClr] [,ShadClr]
  2609.  
  2610.         A virtual screen is defined with the boundaries UpX, UpY, LoX, LoY.
  2611.         The color attributes for this new screen are set to FGClr, BKClr. The
  2612.         area enclosed within this new screen is not cleared. Each window type
  2613.         has a different frame drawn around the window.
  2614.  
  2615.            Window0     No frame
  2616.            Window1     Single line
  2617.            Window2     Double line
  2618.            Window3     Heavy line
  2619.            Window4     Single line with shadow
  2620.  
  2621.         The cursor is positioned in the upper left corner of the window
  2622.         (location 1,1 for the new screen). This virtual screen will wrap at
  2623.         the new column boundaries and scroll at the new row boundaries. This
  2624.         screen appears in every way to DOS as the full size of the screen.
  2625.  
  2626.                                  ====================
  2627.  
  2628.                       WRITE StringToWrite [,ForeClr] [,BackClr]
  2629.  
  2630.         Write the string contained in StringToWrite at the current cursor
  2631.         location using foreground color attribute ForeClr and background color
  2632.         attribute BackClr. In the absence of ForeClr and BackClr use the
  2633.         current color attributes. If the string contains imbedded color
  2634.         attributes, change the colors in the string according to these values.
  2635.         (See Imbedded Color Commands). The string is not followed by a
  2636.         carriage return, line feed pair (i.e. the cursor is not moved to the
  2637.         first position of the next line).
  2638.  
  2639.         Write the string "Enter your password" in black on white.
  2640.            Write "Enter your password ",0,7
  2641.  
  2642.         Write "Invalid directory name" contained in a variable using the
  2643.         composite color 112, also contained in a variable.
  2644.            Variable ErrMsg1,25,"Invalid directory name."
  2645.            Variable ErrClr,3,112
  2646.            Write ErrMsg1,ErrClr
  2647.  
  2648.         Write the string "Menu of choices" with the "M" in Menu written in
  2649.         color 112 and the remainder of the string written in  color 31.
  2650.            Variable MenuTitle,23,'@112M@031enu of choices'
  2651.            Write MenuTitle
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.                                         Page 40
  2665.  
  2666.  
  2667.  
  2668.  
  2669.         
  2670.                                        ====================
  2671.  
  2672.                  WRITEAT XLoc, YLoc, StringVal [,ForeClr] [,BackClr]
  2673.  
  2674.         Write the value contained in StringVal at column location contained in
  2675.         XLoc and at row location contained in YLoc using the foreground color
  2676.         attribute contained in ForeClr and the background color attribute
  2677.         contained in BackClr. In the absence of ForeClr and BackClr, use the
  2678.         current color attributes. The string is not followed by a carriage
  2679.         return, line feed pair (i.e. the cursor is not moved to the first
  2680.         position of the next line).
  2681.  
  2682.            Variable TitleClr,3,112
  2683.            Variable CurrX,2
  2684.            Variable CurrY,2
  2685.            Variable CompName,25,"The ABC Company"
  2686.            WriteAt  15,3,"The ABC Company",TitleClr
  2687.            WriteAt  CurrX,CurrY,CompName
  2688.  
  2689.         In the first usage of the WriteAt command, the literal "The ABC
  2690.         Company" is written at column 15, row 3. In the second usage, the
  2691.         contents of the variable CompName ("The ABC Company") is written at
  2692.         the column location specified by the contents of variable CurrX and at
  2693.         the row location specified by the contents of variable CurrY.
  2694.  
  2695.                                  ====================
  2696.  
  2697.                         WRITELINE StringToWrite [,LineNumber]
  2698.  
  2699.         Write the string contained in StringToWrite beginning at position 1 of
  2700.         the line number specified in LineNumber. Follow the string with a
  2701.         carriage return line feed pair (i.e. move the cursor to the first
  2702.         position of the next line). In the absence of LineNumber write the
  2703.         string at the current cursor location. Expand any imbedded color
  2704.         commands in the string. (See note below on imbedded color commands).
  2705.  
  2706.            WriteLine "Please read these instructions ",7
  2707.  
  2708.         The message "Please read these instructions " is written beginning in
  2709.         column 1 of row 7. Follow the string with a CR/LF.
  2710.  
  2711.            WriteLine Msg5
  2712.  
  2713.         Write the contents of the variable Msg5 beginning at the current
  2714.         cursor location. Follow the string with a CR/LF.
  2715.  
  2716.            Write "Enter the letter of the selected drive > "
  2717.            ReadKey  InKey
  2718.            WriteLine   ""
  2719.  
  2720.         Write the string "Enter the letter of the selected drive > ", leaving
  2721.         the cursor positioned at the end of this message (the Write command
  2722.         does not supply a CR/LF. After receiving the entry from the user,
  2723.         position the cursor at the beginning of the next line by "writing" to
  2724.         the screen a null string (two quote marks without any character
  2725.         between) using the WriteLine command. This will write to the screen
  2726.         only a CR/LF.
  2727.  
  2728.  
  2729.                                         Page 41
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.                                          STANDARD VARIABLES
  2736.  
  2737.         There are several variables which are in every PowerBatch program.
  2738.         These Standard Variables may be referenced without having to define
  2739.         them with a Variable command.
  2740.  
  2741.            
  2742.      DispAdapter - This 4 character variable will contain a code describing
  2743.            the type of display controller card located in your system. If the
  2744.            first character contains "M", the adapter is a monochrome adapter.
  2745.            If the first character contains "C", the adapter is a color
  2746.            adapter. The remaining 3 characters may contain:
  2747.                  MDA-Monochrome Display Adapter
  2748.                  CGA-Color Graphics Adapter
  2749.                  EGA-Extended Graphics Adapter
  2750.                  VGA-Video Graphics Array
  2751.                  MGA-Multi-color Graphics Array
  2752.               If no video adapter is found the field will contain "NONE".
  2753.  
  2754.            
  2755.      DOSError - If the external program which you execute sets a DOS error
  2756.            code, the error code will be placed in this variable.
  2757.  
  2758.            
  2759.      DOSVer - This field will contain a 4 character code for the version of
  2760.            DOS installed. The first two characters are the major version and
  2761.            the last two the minor version. DOS 6.0 will be reported as 0600.
  2762.  
  2763.            
  2764.      ErrorLevel - If the external program which you execute sets an
  2765.            ErrorLevel and that ErrorLevel is returned to PowerBatch by DOS,
  2766.            it will be placed in this variable.
  2767.  
  2768.            
  2769.      ParallelPorts - This variable will contain the number of parallel ports
  2770.            supported by your hardware.
  2771.  
  2772.            
  2773.      SerialPorts - This variable will contain the number of serial ports
  2774.            supported by your hardware.
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.                                         Page 42
  2800.  
  2801.  
  2802.  
  2803.  
  2804.         
  2805.                                           Command Summary
  2806.  
  2807.         ?Color      Foreground Background Composite
  2808.         ?CurrDir    CurrDrive CurrDirectory
  2809.         ?Date       DayOfWeek Month Day Year
  2810.         ?DirExist   DirName FoundLbl [NotFoundLbl]
  2811.         ?DiskInfo   DriveLetter VolID DriveType
  2812.         ?DiskSpace  DriveLetter TotalSpace FreeSpace
  2813.         ?DriveExist DriveLetter ValidLabel [InvalidLabel]
  2814.         ?EnvStr     EnvironName EnvironNameContents
  2815.         ?FileExist  FileName FoundLabel [NotFoundLabel]
  2816.         ?FileExpan  FileName FoundLabel [NotFoundLabel]
  2817.         ?FileSize   FileSize FileName
  2818.         ?Inpath     DirName FoundLabel [NotFoundLabel]
  2819.         ?Time       CurrentTime
  2820.         Add         Sum Number
  2821.         AppendFile  FileName FileRecord
  2822.         Blink
  2823.         Boot
  2824.         Box0-3      Ux Uy Lx Ly ForeClr [BackClr]
  2825.         Box4        Ux Uy Lx Ly ForeClr [BackClr] [ShadowClr]
  2826.         BreakOn
  2827.         BreakOff
  2828.         Center      TextToCenter LineNum
  2829.         ChDir       DirName
  2830.         Clear       FgrndClr [BgrndClr] [ClearChar] [BorderClr]
  2831.         ClearBox    Ux Uy Lx Ly FgClr [BkgClr] [ClearChar]
  2832.         ClearLine   LineNum ForeGrndClr [BackgrndClr]
  2833.         Color       ForeGroundClr [BackGroundClr]
  2834.         Compare     Value1 Value2 1GR2 [1Less2] [1Eq2]
  2835.         Concat      Target String1 [String2]
  2836.         Cursor      CursorType (1=Normal,2=Off,3=Fat,4=Block)
  2837.         Divide      Result Divisor [Remainder]
  2838.         FlushKey
  2839.         GoTo        Label
  2840.         GoToXY      XCo-ord YCo-ord
  2841.         Halt        [ErrorLevel]
  2842.         Label       LabelName
  2843.         Length      StringLength String
  2844.         Lower       String
  2845.         MidString   NewString OldString Offset Length
  2846.         Multiply    Result Number
  2847.         Normal
  2848.         PrintScr
  2849.         Prompt      NewPromptVal
  2850.         Random      UpperLimit Result
  2851.         ReadKey     Target [SpecInd] [Timeout] [NoPrt] [CtlChar]
  2852.         ReadStr     Target [Timeout]
  2853.         ReadUpKey   Target [Timeout]
  2854.         ReadYN      Message Target [Timeout] [NoPrt]
  2855.         Reverse
  2856.         ScrMode     Mode
  2857.         SetEnv      EnvironName EnvironValue
  2858.         SetPath     NewPath
  2859.         SetVar      VariableName Value
  2860.         Subtract    Total Number
  2861.         Upper       VariableName
  2862.         Variable    VariableName MaxLength [InitialValue]
  2863.  
  2864.                                         Page 43
  2865.  
  2866.  
  2867.  
  2868.  
  2869.         Wait        TimeToWait (in tenths of a second)
  2870.         Window0-3   UpX UpY LoX LoY FgClr [BkClr]
  2871.         Window4     UpX UpY LoX LoY FgClr [BkClr] [ShadClr]
  2872.         Write       StringToWrite [ForeClr] [BackClr]
  2873.         WriteAt     XLoc YLoc StringVal [ForeClr] [BackClr]
  2874.         WriteLine   StringToWrite [LineNumber]
  2875.  
  2876.         Standard Variables
  2877.         ==================
  2878.         DispAdapter    Current display adapter
  2879.         DOSError       Last DOS error code
  2880.         DOSVer            Running DOS version
  2881.         ErrorLevel     Last DOS errorlevel
  2882.         ParallelPorts  Num of parallel ports in running machine
  2883.         SerialPorts    Num of serial ports in running machine
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.                                         Page 44
  2929.  
  2930.  
  2931.  
  2932.  
  2933.         
  2934.                                          Compilation Errors
  2935.  
  2936.         Compilation errors are printed on the screen and also written in a
  2937.         file named ProgName.MAP where ProgName is the name of the program you
  2938.         have just compiled (If you have a split screen editor, view the source
  2939.         in one screen part and the errors in the other part). If the source
  2940.         line is available, the source line is printed above the error preceded
  2941.         by the line number count. Source lines are not available during the
  2942.         second pass of the compiler which may generate "Label not defined" and
  2943.         "Variable not defined" errors.
  2944.  
  2945.               
  2946.            "Not a valid command" - This error is generated when the first
  2947.               word on the command line is not a PowerBatch command and
  2948.               contains more than 8 characters.
  2949.  
  2950.               Example:
  2951.               13 Directory name checked here.
  2952.               [DIRECTORY] Not a valid command
  2953.  
  2954.                  
  2955.               Probably should be
  2956.               ;Directory name checked here
  2957.  
  2958.               
  2959.            "Missing variable" - A command contains less than the required
  2960.               number of operands.
  2961.  
  2962.               Example:
  2963.               21 ?Color   ForeColor,BackColor
  2964.               [] Missing variable
  2965.  
  2966.               Variable for the composite color byte is missing.
  2967.  
  2968.               
  2969.            "Expected a variable Name" - A string was found in an operand that
  2970.               may contain only a variable name.
  2971.  
  2972.               Example:
  2973.               10 ?Time "Current Time"
  2974.               [Current Time] Expected a variable name
  2975.  
  2976.               The current time may only be placed in a variable.
  2977.  
  2978.               
  2979.            "Quoted literal not terminated" - A single quote was encountered
  2980.               within a source line.
  2981.  
  2982.               Example:
  2983.               9 Center "Move Command,5
  2984.               [] Quoted literal not terminated
  2985.  
  2986.               Closing quote should precede comma.
  2987.  
  2988.               
  2989.            "Invalid max length specified" - The second operand of a variable
  2990.               definition should specify the maximum length of the variable.
  2991.               The value found was not numeric.
  2992.  
  2993.               Example:
  2994.               3 Variable  CompName,"The ABC Company"
  2995.                  
  2996.               [The ABC Company] Invalid max length specified
  2997.  
  2998.               
  2999.            "Variable not defined" - A reference to a variable was made in the
  3000.  
  3001.                                         Page 45
  3002.  
  3003.  
  3004.  
  3005.  
  3006.               source file but the variable was not defined with the Variable
  3007.               command.
  3008.  
  3009.               Example:
  3010.               [CURRDATE] Variable not defined
  3011.  
  3012.               
  3013.            "Duplicate variable" - The same variable name has appeared 2 or
  3014.               more times in a Variable definition statement.
  3015.  
  3016.               Example:
  3017.               7 Variable  CompName,25
  3018.               [COMPNAME] Duplicate variable
  3019.  
  3020.               
  3021.            "Duplicate label" - The same label name has appeared 2 or more
  3022.               times in a Label definition statement.
  3023.  
  3024.               Example:
  3025.               16 Label    Step2
  3026.               [STEP2] Duplicate label
  3027.  
  3028.               
  3029.            "Invalid hex definition in variable" - A variable definition
  3030.               contained a # not enclosed in quotes signifying a value
  3031.               definition by ASCII value. The characters following this # were
  3032.               not numeric or did not equate to an ASCII character.
  3033.  
  3034.               Example:
  3035.               Variable Return,2,#J#219
  3036.  
  3037.                  #J is not valid
  3038.  
  3039.               
  3040.            "External command >" - This is not an error message, but is a
  3041.               check to alert you to each command found in a PowerBatch source
  3042.               file that will be treated as an external command. External
  3043.               commands are DOS intrinsic commands, .COM, and .EXE commands or
  3044.               programs (even PowerBatch compiled programs) and .BAT (standard
  3045.               DOS batch files) that are to be executed by PowerBatch.
  3046.  
  3047.               Example:
  3048.               External command > 12 DIR  (DOS directory command)
  3049.               External command > 29 MYPROG (Exe module MYPROG)
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.                                         Page 46
  3070.  
  3071.  
  3072.  
  3073.  
  3074.         
  3075.                                                Examples
  3076.  
  3077.         The source for several examples is contained on your installation
  3078.         disk. You may print these examples by entering:
  3079.  
  3080.            COPY INQUIRE.PWR LPT1
  3081.  
  3082.         These examples may be compiled using the PowerBatch command by
  3083.         entering a command similar to:
  3084.  
  3085.            PowerBatch INQUIRE <enter>
  3086.  
  3087.         This compiles the source for INQUIRE.
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.                                         Page 47
  3135.  
  3136.  
  3137.  
  3138.  
  3139.                                IMBEDDED COLOR COMMANDS
  3140.  
  3141.         A literal or a variable may be defined which has color commands
  3142.         imbedded in the text of the literal allowing you to change the color
  3143.         in the middle of the string to be printed. If you were creating a
  3144.         tutorial and wanted a menu at the bottom of the screen that gave the
  3145.         user several command choices and you wanted this menu to have the
  3146.         first character of each command in reverse video, PowerBatch provides
  3147.         a means to accomplish this easily. Suppose the command line is:
  3148.  
  3149.            Next Prev Load ........
  3150.  
  3151.         and the N, P, and L were to be in reverse video you would define the
  3152.         variable (or literal) as:
  3153.  
  3154.            Variable Cmd,75,"@112N@007ext @112P@007rev @112L@007oad"
  3155.  
  3156.         IN THIS EXAMPLE THE @ REPRESENTS CTRL-A BECAUSE OUR PRINTER WILL NOT
  3157.         PRINT A CTRL-A!
  3158.  
  3159.         The syntax for imbedded color commands is Ctrl-A followed by the THREE
  3160.         digit color attribute. Thus @112 means change the color to 112 and
  3161.         continue printing in this color until another change is made. Further
  3162.         examining the line...@112N@007ext means change to color 112, print N,
  3163.         change to color 007, print ext (Next).
  3164.  
  3165.         The ASCII value of Ctrl-A is 001. Most text editors will allow you to
  3166.         enter an ASCII character by entering the actual ASCII value by
  3167.         pressing the Alt key and entering the ASCII value on the numeric
  3168.         keypad (not the numbers above the character keyboard). Thus entering
  3169.         Ctrl-A becomes as simple as pressing Alt-1.
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.                                         Page 48
  3199.  
  3200.  
  3201.  
  3202.  
  3203.         
  3204.                                       Composite Color Values
  3205.  
  3206.                              Color Names And Their Values
  3207.                              ============================
  3208.         Black (Blk)    0     Dk. Gray (DGy)    8
  3209.         Blue (Blu)     1     Lt. Blue (LBl)    9
  3210.         Green (Grn)    2     Lt. Green(LGr)    10
  3211.         Cyan (Cyn)     3     Lt. Cyan (LCy)    11
  3212.         Red (Red)      4     Lt. Red (Lrd)     12
  3213.         Magenta (Mag)  5     Lt. Magenta (LMg) 13
  3214.         Brown (Brn)    6     Yellow (Yel)      14
  3215.         Lt. Gray (LGy) 7     White (Wht)       15
  3216.  
  3217.         On the following page is two tables which give the ASCII value for the
  3218.         composite color byte (the single byte DOS uses to identify the current
  3219.         color). This single value is a composite of the two values for the
  3220.         background and foreground color values.  To arrive at the composite
  3221.         value multiply the background color value by 16 and add the foreground
  3222.         color value. Some examples will help explain:
  3223.            Red on Blue
  3224.            (Blue * 16) + Red = 20        (001 * 16) + 4 = 20
  3225.  
  3226.            White on Red
  3227.            (Red * 16) + White = 79       (004 * 16) + 15 = 79
  3228.  
  3229.         Verify these composite calculations by finding the corresponding
  3230.         values in the tables on the next page. To find Red on Blue, find the
  3231.         background color down the left side of the table and the foreground
  3232.         color across the top. Blue is the second color down and Red the fifth
  3233.         color across; at this intersection you will find the value 020.
  3234.         (Remember the color values begin with zero). Red is the fifth color
  3235.         down and White is the 16 color across; at this intersection is value
  3236.         079.
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.                                         Page 49
  3264.  
  3265.  
  3266.  
  3267.  
  3268.                                   Normal (non-blinking) Colors
  3269.  
  3270.          Blk Blu Grn Cyn Red Mag Brn LGy DGy LBl LGr LCy Lrd LMg Yel Wht
  3271.          === === === === === === === === === === === === === === === ===
  3272.      Blk|000|001|002|003|004|005|006|007|008|009|010|011|012|013|014|015|
  3273.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3274.      Blu|016|017|018|019|020|021|022|023|024|025|026|027|028|029|030|031|
  3275.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3276.      Grn|032|033|034|035|036|037|038|039|040|041|042|043|044|045|046|047|
  3277.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3278.      Cyn|048|049|050|051|052|053|054|055|056|057|058|059|060|061|062|063|
  3279.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3280.      Red|064|065|066|067|068|069|070|071|072|073|074|075|076|077|078|079|
  3281.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3282.      Mag|080|081|082|083|084|085|086|087|088|089|090|091|092|093|094|095|
  3283.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3284.      Brn|096|097|098|099|100|101|102|103|104|105|106|107|108|109|110|111|
  3285.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3286.      Gry|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|
  3287.         |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  3288.  
  3289.                                   Color Which Blink
  3290.  
  3291.      To make any color blink, add 128 to the value in the table above. For
  3292.      example; to have a red blinking character on a blue background the value
  3293.      would be (20 + 128) = 148.
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.                                         Page 50
  3328.  
  3329.  
  3330.  
  3331.  
  3332.      ASP 1                             Flush Keyboard 29
  3333.      Border Color 25                   Frame 22, 23
  3334.      Box 22, 23                        Imbedded Colors 48
  3335.      Box With Shadow 23                Installation 5
  3336.      Case                              Interior of a box 25
  3337.         Lower 31                       Introduction 1
  3338.         upper 35, 38                   Keyboard Input
  3339.      CD, ChDir 24                         ReadKey 33
  3340.      Center A Line Of Text 24             ReadStr 35
  3341.      Color attribute 12, 14, 32           ReadUpKey 35
  3342.      Command Line Parameters 11, 39       ReadYN 36
  3343.      Command Notation 12               Labels 9
  3344.      Command Summary 43                License Agreement 2
  3345.      Command Syntax 13                 Literals 7, 8
  3346.      Comments 7                        Monitor Type 42
  3347.      Compare                           ParallelPorts 42
  3348.         alphabetic 27                  Passing Parameters
  3349.         numeric 27                           11
  3350.      Compilation Errors 45             PATH 11
  3351.      Composite Color Values 49         Is Dir In 20
  3352.      Concatenate Strings 28            SetPath 37
  3353.      Concept Of Operation 3            Pause 39
  3354.      Copyright 1                       Pause A Program 39
  3355.      Ctrl - Break 23                   PowerBatch Commands
  3356.      Current Date 15                      ?Color 14
  3357.      Current Directory 15                 ?CurrDir 15
  3358.      Current Drive 15                     ?Date 15
  3359.      Current Time 20                      ?DirExist 16
  3360.      Cursor Postion 30                    ?DiskInfo 16
  3361.      Directory 16                         ?DiskSpace 17
  3362.      Directory Exists 16                  ?DriveExist 17
  3363.      Directory, Change to new 24          ?EnvStr 18
  3364.      Disk capacity 17                     ?FileExist 18
  3365.      Disk Drive                           ?FileExpand 19
  3366.         Valid Letter 17                   ?FileSize 19
  3367.      Disk Space                           ?InPath 20
  3368.         Free 17                           ?Time 20
  3369.         Total 17                          Add 20
  3370.      DOS errorlevel 30                    Beep 21
  3371.      DOS search path 20                   Blink 21
  3372.      DOS Version 42                       Boot 21
  3373.      DOSERROR 10, 42                      Box 22, 23
  3374.      Drive Type 16                        BreakOff 23
  3375.      Drive, Change to new 24              BreakOn 23
  3376.      Environment Variables 11             Center 24
  3377.         Contents 18                       ChDir 24
  3378.         SetEnv 37                         Clear 25
  3379.         SetVar 38                         ClearBox 25
  3380.      ERRORLEVEL 10, 30, 42                ClearLine 26
  3381.      External Commands 9, 46              Color 26
  3382.      Field length                         Compare 27
  3383.         maximum 35                        Concat 28
  3384.      File exists 18, 19                   Cursor 28
  3385.      File Size 19                         Divide 29
  3386.      FileName                             FlushKey 29
  3387.         Does It Exist 18                  GoTo 29
  3388.         Full Path Name 19                 GoToXY 30
  3389.  
  3390.  
  3391.                                         Page 51
  3392.  
  3393.  
  3394.  
  3395.  
  3396.         Halt 30                           Window 40
  3397.         Label 30
  3398.         Length 31
  3399.         Lower 31
  3400.         MidString 31
  3401.         Multiply 32
  3402.         Normal 32
  3403.         PrintScr 32
  3404.         Prompt 32
  3405.         Random 33
  3406.         ReadKey 33
  3407.         ReadStr 35
  3408.         ReadUpKey 35
  3409.         ReadYN 36
  3410.         Reverse 36
  3411.         ScrMode 37
  3412.         SetEnv 37
  3413.         SetPath 37
  3414.         SetVar 38
  3415.         Subtract 38
  3416.         Upper 38
  3417.         Variable 39
  3418.         Wait 39
  3419.         Window 40
  3420.         Write 40
  3421.         WriteAt 41
  3422.         WriteLine 41
  3423.      PROMPT 11
  3424.      Random Numbers 33
  3425.      Registration 1
  3426.      Screen
  3427.         Clear 25
  3428.         Color 26
  3429.      Screen Window 40
  3430.      SerialPorts 42
  3431.      SETENV 11
  3432.      SETPATH 11
  3433.      Shareware 1
  3434.      Software Support 2
  3435.      Standard Variables
  3436.         DispAdapter 42
  3437.         DOSError 42
  3438.         DOSVer 42
  3439.         ErrorLevel 42
  3440.         ParallelPorts 42
  3441.         SerialPorts 42
  3442.      String length 31
  3443.      Syntax
  3444.         Compilation 6
  3445.      System speaker 21
  3446.      Time, Current 20
  3447.      Trademarks 2
  3448.      Variable map 6
  3449.      Variables 7
  3450.         Value Of 38
  3451.      Virtual Window 40
  3452.      Volume ID 16
  3453.  
  3454.  
  3455.                                         Page 52
  3456.  
  3457.