home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ebl.zip / BATDOC2.BAT < prev    next >
DOS Batch File  |  1988-10-11  |  31KB  |  836 lines

  1. bat /p * Loading HELP and DOCUMENTATION part 2
  2.  
  3. *           Written by F.Canova 10/5/83 through 07/7/86
  4. *   (c) Copyright 1983, 1985, 1986 by Seaware Corp. all rights reserved.
  5. *    This batch file REQUIRES EBL Version 3 for proper execution!
  6.  
  7.          **** NOTE! NOTE! NOTE! NOTE! ****
  8.  RAM    |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
  9.  
  10.  if %G = .goto. then %G = | goto -%F
  11.  beep type Error! Begin by using BATDOC first!
  12.  type This file is an overlay to BATDOC.
  13.  exit
  14.  
  15. -opt0     %F = opt0     | skip 3
  16. -line0     %F = line0    | skip 2
  17. -line599  %F = line599 | skip 1
  18. -line1405 %F = line1405
  19.     %G = .goto.
  20.     color 8f |type Loading part 1 ...
  21.     color 07 |type
  22.     leave
  23.     batdoc
  24.  
  25. -header * Routine prints general purpose header for help text
  26.     stack.purge            |*  remove any pre-typed keystrokes.
  27.     %n = %i $ 1 ( %i # - 2 ) & . & ( %i $ ( %i # - 1 ) 2 ) |* extract section # from page #
  28.     cls begtype
  29. \17╔══════════════════════════════════════════════════════════════════════════════╗\1F
  30.     \%H                       Page \%n                   \17
  31. ╚══════════════════════════════════════════════════════════════════════════════╝\07
  32.     Press:  PGDN for next page,   PGUP for prev page,  HOME for main menu.
  33.  
  34. end
  35.     return
  36.  
  37. -scroll * Routine accepts key for scrolling help text
  38.     %e = 0
  39.     inkey %k
  40.     if %k = KEY003         goto -opt0 |* Break key
  41.     if %k = KEY01B %i = 0       | goto -line0    |* ESC    key
  42.     if %k = KEY147 %i = 0       | goto -line0    |* Home key
  43.     if %k = KEY149 %i = %i - 1 | cls | goto -line%i |* PgUp key
  44.     if %k = KEY151 %i = %i + 1 | cls | goto -line%i |* PgDn key
  45.     goto -scroll |* ignore any other key.
  46.  
  47.     * ROUTINE TO HAVE USER GIVE A COMMAND A TRY !!
  48.     * %A = string which must match
  49. -tryit
  50.     begtype
  51.  
  52.   Enter your guess!  ;
  53. end
  54. -tryit.loop
  55.     if .%a = . goto -tryit.solved.it |* end of string ?
  56.     %b = %a $ 1 1        |* get 1st letter
  57.     %a = %a $ 2        |* remove it from string
  58. -tryit.retry
  59.     inkey %k        |* get a key.
  60.     if %k = KEY020 type %b; | goto -tryit.loop
  61.     if %k = KEY01B type %b%a| goto -tryit.give.up
  62.     if %k = %b type %k;    | goto -tryit.loop
  63.     beep goto -tryit.retry
  64.  
  65. -tryit.solved.it
  66.     begtype
  67.  
  68.  
  69. EXCELLENT !! - that's exactly it!
  70.  
  71. end
  72.     read Press the ─┘ key to continue to next section.....
  73.     return
  74.  
  75. -tryit.give.up
  76.     begtype
  77.  
  78. That's the answer you needed! (You can "peek" at part of
  79. the answer next time by pressing the space bar if you'd like.)
  80.  
  81. end
  82.     read Press the ─┘ key to continue to next section.....
  83.     return
  84.  
  85. -opt6
  86. -line503 %i = 600
  87. -line600 %H = "How to print" | call -header| begtype
  88.  
  89.   The simplest thing to for Extended Batch Language to do is to print text
  90. on the display.  This is done by either of two commands, TYPE and BEGTYPE.
  91.  
  92.   The TYPE command can be used for something as simple as saying hello!
  93. Let's look at a simple EBL batch file...
  94.  
  95.     BAT /P /S            <This starts up EBL. Use it at the top.
  96.     TYPE "HELLO WORLD"              <This types a message
  97.  
  98.   This is all that is needed.  This command can be typed directly from DOS
  99. (this is called immediate mode) or be entered into a file such as
  100. "TRIAL.BAT" (this is called direct execution mode).  To execute it as a EBL
  101. program with the file, just type the file's name "TRIAL" from DOS and you
  102. will see the results of the program "HELLO WORLD" coming from EBL.
  103. end
  104.     goto -scroll
  105. -line601 call -header | begtype
  106.   You can also put DOS variables into this command to display their
  107. contents.  For example, if the "TRIAL.BAT" file contained the line:
  108.  
  109.     BAT /P /S            <This starts up EBL. Use it at the top.
  110.     TYPE "HELLO THERE" %1 %2        <This types a message & two variables
  111.  
  112.   Then when we start the BAT program from DOS, we might enter:
  113.  
  114.     TRIAL COMPUTER USER
  115.  
  116.   DOS will automatically store the words after the program name into its
  117. variables.  Therefore, in the TYPE command, we will see contents of these
  118. variables on the screen.  That is 'COMPUTER' -> %1 and 'USER' -> %2.
  119. The resulting message would be:
  120.  
  121.     HELLO THERE COMPUTER USER
  122.  
  123. In the upcoming examples we will not show 'BAT /P /S', but always use it at
  124. the top of any batch file when you want EBL to work on the file.
  125. end
  126.     goto -scroll
  127. -line602 call -header | begtype
  128.  
  129.   There is a second method of putting text onto the display.  This is with
  130. the BEGTYPE command.  Although it will not display the contents of
  131. variables, it is very useful for displaying large blocks of text, such as
  132. menus.    For example, if the "TRIAL.BAT" file contains:
  133.  
  134.     BEGTYPE
  135.      This is a large block of text. It is useful for menus. Note
  136.      that Upper/Lower case characters are displayed intact here.
  137.      The block is always ended with "END" in the first column
  138.      after the text finishes.
  139.     END
  140.  
  141.   When executed, the "TRIAL.BAT" program will display:
  142.  
  143.      This is a large block of text. It is useful for menus. Note
  144.      that Upper/Lower case characters are displayed intact here.
  145.      The block is always ended with "END" in the first column
  146.      after the text finishes.
  147. end
  148.     goto -scroll
  149. -line699 %i = 603
  150. -line603 call -header | begtype
  151.  
  152.   There is an additional advantage to using BEGTYPE command.  This command
  153. can also highlight text to the user.  This is done by using the form:
  154. [\\hex] within the text block.
  155.  
  156.   For example if the text block contained \\0F within the text, the result
  157. would be \0F High Intensity Text !  \07.
  158.  
  159.   By choosing different values, the screen attributes can be controlled to
  160. create inverted video, blinking, underlined, and very colorful text.
  161.  
  162.   You can also display the contents of variables by using [\\%Var.name] in
  163. the text block. For instance, if the variable %0 is to be printed, use \\%0
  164. within the text after the BEGTYPE command.
  165.  
  166.   An additional command CLS can be used to clear the display before
  167. printing data.    For instance, the combination "BAT CLS BEGTYPE" is quite
  168. useful for printing menus and text such as this screen.
  169. end
  170.     goto -scroll
  171. -line604
  172.     begtype
  173.  
  174.     \0fNOW IT'S YOUR TURN !!!\07
  175.  
  176.  
  177. If the \0f%4\07 variable contains the word \0fDAY\07, what is the command to display
  178. the words "\0fFUN DAY\07" on the display?
  179.  
  180. end
  181.      %A = "TYPE FUN %4" | Call -tryit
  182. -opt7
  183. -line605  %i = 700
  184. -line700 %H = "Reading things from user" | call -header | begtype
  185.   In order to get input from the user, there are two available commands,
  186. READ and INKEY.
  187.  
  188.   When the command word READ is seen in the batch file, an input line is
  189. accepted from the user.  All function keys are assigned to the normal DOS
  190. edit functions.  When ENTER is pressed, the input line is assigned to DOS
  191. variables.
  192.  
  193.   Each word will be assigned in order to the variables indicated after the
  194. READ command.  When there are no more variables after the READ command to
  195. assign, the remainder of the response is thrown away.  If there are more
  196. variables to be assigned after the READ command than there are words from
  197. the user, these variables will be cleared out to a empty state.  For
  198. example:
  199.  
  200.     READ Please enter your name ==> %1 %2
  201.  
  202.   This would prompt the user and wait for him to enter two words.  These
  203. words will be saved in the %1 and %2 variables.
  204. end
  205.      goto -scroll
  206. -line701 call -header | begtype
  207.  
  208.   Note that there does not have to be any variables indicated after the
  209. command READ.  In this case, BAT would wait for the enter key, throw away
  210. any response, then continue to process the next batch file command.
  211.  
  212. end
  213.     goto -scroll
  214. -line702 call -header | begtype
  215.  
  216.   In the event that you wish to get a single keystroke from the user, the
  217. INKEY command should be used.
  218.  
  219.   This command will wait for the user to enter a single key on the keyboard
  220. and return its value in the optional variable.    This key can be not only
  221. letters, but all function keys, control keys, etc.  For example:
  222.  
  223.     INKEY Press any key to continue... %0
  224.  
  225.   When the user presses a single key, that key is saved into the variable %0.
  226.  
  227.   If the key that is pressed is in the range of "!" to "z" (decimal 33 to
  228. 122) then the key saved to the optional variable. If you wish this key to be
  229. echoed to the display, you must specifically use the TYPE command.
  230.  
  231. end
  232.      goto -scroll
  233. -line799 %i = 703
  234. -line703 call -header | begtype
  235.  
  236.   If the key is not in the above range, then the key will be converted to
  237. the form "KEYxxx" where xxx is the hex value of the key.  Extended key
  238. codes will be in the range KEY100 to KEY1FF and nonextended key codes will
  239. be in the range KEY000 to KEY0FF.  Refer to Appendix G of the Basic manual
  240. for a complete description of the various assignments of key codes.
  241.  
  242.   The character does not have to be assigned to a variable.  If the
  243. variable name is not present following the command INKEY, the system will
  244. wait for any key to be pressed from the user, and then continue processing.
  245.  
  246. end
  247.     goto -scroll
  248. -line704
  249.     begtype
  250.  
  251.     \0fNOW IT'S YOUR TURN !!!\07
  252.  
  253.  
  254.   We wish to create a menu with several options.  At a "\0f=>\07" prompt,
  255. the user must enter a \0fsingle letter\07 to select his option.  What is
  256. the command needed to request a single keystroke into the \0f%4\07
  257. variable for option selection using the prompt above?
  258.  
  259. end
  260.      %A = "INKEY => %4" | call -tryit
  261. -opt8     %i = 800
  262. -line800 %H = "Program Control" | call -header| begtype
  263.   There are several ways of controlling the order of execution of a program
  264. written with Extended Batch Language.  GOTO, CALL, RETURN, and IF are all
  265. commands that do this.    The simplest is the GOTO command:
  266.  
  267.     GOTO -LABEL
  268.  
  269.   If this line is put into a ".BAT" file, then it will stop execution at
  270. this line and resume at the line within the file which contains:
  271.  
  272.     -LABEL
  273.  
  274.   This is a unconditional branch.  If the label is not present within the
  275. file, and error will result.  Note the minus (-) sign before the label
  276. name.  \0FLabels must be preceded with a minus sign.\07 This is done so
  277. that BAT can tell the difference between a label and a command within the
  278. language.
  279. END
  280.     goto -scroll
  281. -line801 call -header | begtype
  282.  
  283.    A CALL command is similar to a GOTO command.  The primary difference is
  284. that the line where the CALL command was is saved away.  Then a branch to a
  285. label is done, just like the GOTO command.  Note that the CALL command can
  286. be nested up to 31 levels.  When a RETURN command is found, the last line
  287. that was saved is now restored.  Execution resumes at the line following
  288. the original CALL command.
  289.  
  290. END
  291.     goto -scroll
  292. -line802 call -header | begtype
  293. For example, if a program contains:
  294.  
  295.     BAT * CALL/RETURN sample..
  296.          TYPE "One"
  297.          \0FCALL -LABEL\07
  298.          \0FCALL -LABEL\07
  299.          TYPE "Four"
  300.          EXIT
  301.     -LABEL
  302.          TYPE " Two"
  303.          TYPE " Three"
  304.          \0FRETURN\07
  305.  
  306.   You will see on the display:
  307.     One
  308.      Two
  309.      Three
  310.      Two
  311.      Three
  312.     Four
  313. end
  314.     goto -scroll
  315. -line803 call -header | begtype
  316.   The final way to control the flow of an Extended Batch Language program
  317. is to use an IF command.  The general form of this command is:
  318.  
  319.     IF _word_   _condition_   _word_   _operation_______
  320.  
  321.  
  322.   Each word can be a fixed string of letters, or a variable, or a
  323. combination of each.
  324.  
  325.   The conditions can be:
  326.  
  327.     <    less than
  328.     >    greater than
  329.     <>    not equal to
  330.     =    equal to (case insensitive)
  331.     ==    exactly equal to (case sensitive)
  332.  
  333.   The operation can be any of the Extended Batch Language commands.
  334. end
  335.      goto -scroll
  336. -line899 %i = 804
  337. -line804 call -header | begtype
  338.   For example, all of the following IF statements will compare correctly
  339. and execute their corresponding TYPE command.  The first two statements
  340. will initialize variables used in the IF commands.
  341.  
  342.     BAT * IF/THEN/ELSE Examples...
  343.     %1 = "ABC"
  344.     %2 =
  345.  
  346.     IF "ABC" = %1 THEN TYPE The variable contains ABC.
  347.     IF %1 = 'abc' THEN TYPE This also matches.
  348.     IF 0 <> 00    THEN TYPE These are different lengths.
  349.     IF 0 < 00     THEN TYPE 0 has a smaller length.
  350.     IF 456 > 123  THEN TYPE Numerically, 456 is bigger.
  351.     IF 456 < %1   THEN TYPE ASCII value of 456 is smaller.
  352.     IF AABCD = A%1D THEN TYPE String substitutions are made.
  353.     IF %2 <> %1   THEN TYPE Variables are different lengths.
  354.     IF .%2 = .    THEN TYPE This matches if var is empty.
  355.     IF BOX = BOX IF DOG <> CAT THEN TYPE Did multi-if compare.
  356.     IF 1 + 2 = 3  THEN TYPE Arithmetic results match.
  357. end
  358.     goto -scroll
  359. -line805
  360.     begtype
  361.  
  362.     \0fNOW IT'S YOUR TURN !!!\07
  363.  
  364.  
  365.   We wish to make a series of tests on a menu option that a user entered.
  366. It is saved in the variable \0f%4\07.  What command is needed to test for
  367. the letter "\0fA\07"?
  368.  
  369. end
  370.      %A = "IF %4 = A" | call -tryit
  371. -opt9     %i = 900
  372. -line900 %H = "KEYBOARD STACK" | call -header| begtype
  373.   There is a method within the BAT language for answering questions from
  374. programs without operator intervention.  This is done by a "keyboard
  375. stack".  By entering data into the stack, you will essentially be entering
  376. data through your keyboard when any program requests it.  In this way, a
  377. batch file can now answer questions programs may have by 'typing' them for
  378. the user.
  379.  
  380.   The keyboard stack operates in a "first-in first-out" basis.  That is,
  381. the first line of text put into the stack will be the first seen by the
  382. program when it reads the keyboard.  The second line entered will be the
  383. second seen by the program, and so on.    As long as there is text remaining
  384. on the stack, ALL requests for data from the keyboard will actually come
  385. from the stack.  Once the stack has been emptied by the program, data will
  386. then come from the keyboard as usual.
  387.  
  388.   There are two commands which store data into the stack, STACK and
  389. BEGSTACK. Here's some more about them.....
  390. end
  391.      goto -scroll
  392. -line901 call -header | begtype
  393.   The STACK command is very much like the previously mentioned TYPE
  394. command.  Instead of displaying to the screen, it will "push" data into the
  395. keyboard stack area.  When any program is ready to accept information from
  396. the keyboard, the parameters after the STACK command will be used as input.
  397. For example:
  398.  
  399.     BAT * This program will issue remarks to DOS.
  400.         %1 = HELLO
  401.         STACK REM THIS IS A REMARK FOR DOS
  402.         STACK REM VARIABLE %%1 = %1
  403.  
  404. When executed, the following will appear on the screen:
  405.  
  406.     A>REM THIS IS A REMARK FOR DOS
  407.  
  408.     A>REM VARIABLE %1 = HELLO
  409. end
  410.      goto -scroll
  411. -line902 call -header | begtype
  412.   The second command used to stack data is BEGSTACK.  This command is
  413. equivalent to BEGTYPE previously described.  It is useful for dumping large
  414. amounts of data to the stack area.  Although no parameter substitution is
  415. performed, there are several advantages to its use.
  416.  
  417.   First, if a line ends with the ";" (semicolon) character, a carriage
  418. return will NOT be stacked.  Second, if "\\HEX" is used where HEX is a
  419.  
  420. number from 01 to FE, then this exact keyboard value will be stacked.  This
  421. is useful for stacking special control characters and symbols.    Third, if
  422. "\\00\\HEX" is used, an extended key code will be stacked.  This is useful
  423. for stacking function keys and the like.  Refer to the Basic manual in
  424. Appendix G under "Extended Codes".  Fourth, if \\FF\\HEX is used, the stack
  425. will delay the keyboard characters from appearing to the program for HEX
  426. number of CPU "ticks".  There are about 12 hex (18 decimal) ticks per
  427. second in the CPU.  In all cases, the word HEX above represents a two digit
  428. hexadecimal number. Finally, \\\\ can be used to stack a single backslash.
  429.  
  430. Some examples...
  431. end
  432.      goto -scroll
  433. -line903 call -header | begtype
  434. Some examples of BEGSTACK command::
  435.  
  436.     BEGSTACK
  437.     \\09 Will stack the tab key.
  438.     This text will be stacked ;
  439.         on one line!
  440.     \\00\\3B Will stack an F1 key.
  441.     \\\\ is seen as one backslash.
  442.     \\FF\\24 will pause two seconds.
  443.     end
  444.  
  445.  
  446. Hint: Some programs remove keystrokes before accepting a critical key. In
  447. some cases this can be avoided by using \\FF\\01 in the BEGSTACK command.
  448. end
  449.      goto -scroll
  450. -line904 call -header | begtype
  451. Note that in the above examples, the STACK or BEGSTACK commands always are
  452. \0fbefore\07 the command or program that will be using the keystrokes. An
  453. example of this order is:
  454.  
  455.     BEGSTACK
  456.     <<keystroke values needed by the program>>
  457.     END
  458.     <<program that will be controlled by the stack>>
  459.  
  460. An example of using the stack with the COPY command within DOS would be:
  461.  
  462.     BEGSTACK
  463.     This text will be given to the copy command.
  464.     \\00\\3B An F1 key ends the copy.
  465.     END
  466.     COPY CON: result.txt
  467.  
  468. end
  469.      goto -scroll
  470. -line905 call -header | begtype
  471. There are also three control commands which are associated with the stack:
  472.  
  473. STACK.OFF     - Redirects data to come directly from
  474.         the physical keyboard. Does not remove
  475.         any data in the stack.
  476.  
  477. STACK.ON      - Directs data to come from the stack.
  478.         This is the default.
  479.  
  480. STACK.PURGE   - Removes any data from the stack and
  481.         keyboard buffers which are pending.
  482. end
  483.     goto -scroll
  484. -line999 %i = 906
  485. -line906
  486.     begtype
  487.  
  488.     \0fNOW IT'S YOUR TURN !!!\07
  489.  
  490.  
  491.   From our menu, we wish to start up a communications program and
  492. automatically dial a phone number with a smartmodem.  The communications
  493. program we have will take what is typed on the keyboard and send it to the
  494. modem.    The command needed for the modem to dial our phone is
  495. "\0fATD12\07" .  What Extended Batch Language command will force the
  496. communication program to dial this modem command?
  497.  
  498. end
  499.     %A = "STACK ATD12" | call -tryit
  500. -opt10    %i = 1000
  501. -line1000 %H = "GETTING RESULTS!" | call -header | begtype
  502.   The results of programs often need to be known so that some action can
  503. take place after the program ends.
  504.  
  505.   When the command word READSCRN is seen in the batch file, a line of text
  506. is read from the display screen into variables.  Having the ability to read
  507. text from the display can be useful for determining the result of another
  508. program, or making a query for some system status which would not normally
  509. be available within a batch file.  For example, by reading a directory from
  510. the screen, a series of files can be submitted to the macro assembler.
  511. Once the assembly is completed, the status can be read from the screen to
  512. determine if there were errors which would stop the link step.    Virtually
  513. any message which a program can generate can be used as feedback to a batch
  514. file by using READSCRN.
  515. end
  516.       goto -scroll
  517. -line1001 call -header | begtype
  518.   Its operation is very much like the READ command except for the fact that
  519. the information which is being read is coming from the display screen and
  520. not the keyboard.  Like the READ command, the text from the screen is
  521. separated at word boundaries and assigned to variables.  The return
  522. code %R will be reflect the line number on the display that was
  523. read.  This number will be in the range of 1 to 25 for the top to bottom
  524. lines respectively. Once a line is read, this command will be set to read
  525. the previous line. Repeated READSCRN commands will read UP the display!
  526.  
  527. For example:
  528.     CLS
  529.     TYPE HELLO THERE
  530.     READSCRN %A %B %C
  531.  
  532. After execution:
  533.     %A contains HELLO
  534.     %B contains THERE
  535.     %C contains nothing, it is empty.
  536.     %R (return code) contains 1, the line number that was read.
  537. end
  538.       goto -scroll
  539. -line1099 %i = 1002
  540. -line1002
  541.     begtype
  542.  
  543.     \0fNOW IT'S YOUR TURN !!!\07
  544.  
  545.  
  546. From our menu, we have started the IBM Macro Assembler program.  We know
  547. that when this program ends it will report the number of errors found.    We
  548. want to make sure that this number is zero before continuing to the LINK
  549. program.  If we save this number in the variable \0f%A\07, what is the
  550. command to read the assembler result from the display?
  551.  
  552. end
  553.       %A = "READSCRN %A" | call -tryit
  554. -opt11      %i = 1100
  555. -line1100 %H = ASSIGNMENTS     | call -header| begtype
  556.   If the first character in the command is a '%' (Percent sign), then it is
  557. considered to be an assignment statement.  The first variable cannot be any
  558. predefined variable (such as %R or %%), but may be any of the other
  559. variables %0 to %9 and %A to %O.  If a DOS command is later executed and
  560. uses one of the variables, it will be properly replaced with the
  561. contents of that variable.
  562.  
  563. The first assignment string, the operator, and the final strings are optional.
  564. The assignment statement must appear in one of the following forms:
  565.  
  566. \0f[var] = \07- create empty variable
  567. \0f[var] = [string]        \07- simple assignment
  568. \0f[var] = [string] & [string]    \07- concatenate two strings
  569. \0f[var] = [number] + [number]    \07- addition
  570. \0f[var] = [number] - [number]    \07- subtraction
  571. \0f[var] = [number] * [number]    \07- multiplication
  572. \0f[var] = [number] / [number]    \07- division
  573. \0f[var] = [string] #        \07- string length
  574. \0f[var] = [string] $ [index] [length] \07- create substring (like MID$ in BASIC)
  575. end
  576.     goto -scroll
  577. -line1199 %i = 1101
  578. -line1101 call -header | begtype
  579.   \0f[var]\07 - A DOS variable or global user variable %0 to %9 and %A to
  580. %O.  It may not be a predefined variable.
  581.  
  582.   \0f[string]\07 - Any valid quoted text.  Letters, numbers, any variable, or
  583. any combination there of.  "123", 'ABC', and "That's It" are all valid strings.
  584.  
  585.   \0f[number]\07 - Any token with a numeric result in the range of ± 2**64.
  586. For example (if %A contains 34) the three numbers 98, %A, and 12%A5
  587. (equivalent to 12345) would all be valid numbers.
  588.  
  589.   \0f[index]\07 - Same restrictions as [number] above except that an
  590. [index] above 16 is meaningless and is equivalent to the number 16.
  591.  
  592.   \0f[length]\07 - Same restrictions as [number] above except that a
  593. [length] above 15 is meaningless and is equivalent to the number 15.  Note
  594. that [length] is optional and has a default value of 15.
  595.  
  596. end
  597.     goto -scroll
  598. -line1102
  599.     begtype
  600.  
  601.     \0fNOW IT'S YOUR TURN !!!\07
  602.  
  603.  
  604.   We wish to count the number of times that a user has used a certain .BAT
  605. program.  We will keep this count in the global user variable \0f%A\07
  606. which will stay active even BETWEEN batch file execution.  What is the
  607. command needed to increase the value in this variable by one?
  608.  
  609. end
  610.     %A = "%A = %A + 1" | call -tryit
  611. -opt12
  612. -line1103
  613. -line1299 %i = 1200
  614. -line1200 %H = "DEBUGGING AIDS" | call -header| begtype
  615.   As an aid in debugging, the TRACE.ON command enables a trace flag which
  616. causes each line in the BAT program to be printed as it is executed.  Three
  617. '+' (plus) symbols will precede the BAT statement which is printed out as
  618. an aid.  The trace can be turned off at any time by the TRACE.OFF command.
  619.  
  620.   A trace can be active during DOS commands within the BAT program.  In
  621. addition, trace can be enabled/disabled at any time, even in immediate
  622. mode.  Once enabled, it will remain in effect until the TRACE.OFF command
  623. is executed.  Errors, execution of other BAT language files, and even
  624. executing DOS commands will not change the trace mode.
  625. end
  626.       goto -scroll
  627. -opt13
  628. -line1201 %i = 1300
  629. -line1300 %H = "External Functions" | call -header| begtype
  630. External functions give Extended Batch Language additional capabilities.
  631. They are programs that add new commands within the EBL language. Within
  632. these external functions are helpful routines in writing complex EBL
  633. programs. Generally, you will be able to write almost all of your EBL
  634. programs without these functions. Occasionally there may be some special
  635. need for a unique operation that is not part of the commands built into
  636. Extended Batch Language. This set of external functions can therefore be
  637. added to EBL as needed.
  638.  
  639. To use any of these functions, just enter the name of the external function
  640. package from DOS or put the name of the package within your AUTOEXEC.BAT
  641. file.  Your batch files can then have any of the additional capabilities
  642. that are contained within the function package.
  643. end
  644.     goto -scroll
  645. -line1301 call -header | begtype
  646. \0eProvided to non-commercial users to share and copy:\07
  647.  
  648.   \0fBATFUNC1\07  contains    CENTER, CHDIR, DATE, GETDIR, KEYPRESSED, LEFT,
  649.             LOWER, LOCATE, RIGHT, STRIP, TIME, UPPER, WHATFUNC
  650.  
  651. \0eProvided to registered users only:\07
  652.  
  653.   \0fBATFUNC2\07  contains    C2H, D2H, H2C, H2D, INT86, PEEK, POKE, REBOOT,
  654.             WHATFUNC
  655.  
  656.   \0fBATMATH3\07  contains    FLOAT, ABS, FRAC, INT, WHATFUNC
  657.  
  658.   \0fBATALLF\07   contains    all of above functions within one package.
  659.  
  660.   \0fBATXV\07        contains    Extended Variables. Allows almost unlimited
  661.             variable space. Also allows flexible variable
  662.             names, indexing, and array capabilities.
  663.  
  664.   Source code to all external functions is also provided to all registered
  665.   users.
  666. end
  667.       goto -scroll
  668. -line1302 call -header | begtype
  669. A summary of some of the commands provided within BATFUNC1.COM are:
  670.  
  671.   CENTER( string i [pad] )    - Centers a 'string' within an 'i' field
  672.   CHDIR( directory )        - Changes sub-directory to 'directory'
  673.   DATE()            - Returns the system date
  674.   GETDIR()            - Returns the current subdirectory
  675.   KEYPRESSED()            - Returns "T" if any key is pressed
  676.   LEFT( string i [pad] )    - Left justifies 'string' within 'i' field
  677.   LOWER( string )        - Returns 'string' in lower case
  678.   LOCATE x y            - Move cursor to new position x y
  679.   RIGHT( string i [pad] )    - Right justifies 'string' within 'i' field
  680.   STRIP( string [type [char]] ) - Removes blanks or 'char' from 'string'
  681.   TIME()            - Returns the system time
  682.   UPPER( string )        - Returns 'string' in upper case
  683.   WHATFUNC()            - Returns the names of the functions loaded
  684.  
  685. Complete details of each function, including examples, can be found in the
  686. Extended Batch Language Version 3 Users Guide starting on page 163.
  687. end
  688.       goto -scroll
  689. -line1399 %i = 1303
  690. -line1303 call -header | begtype
  691. These functions can be used any place a variable or other values can be used.
  692. For instance, they can be used in an expression:
  693.  
  694.     %A = LEFT( %B 8 )
  695.  
  696. They can be used in a condition statement:
  697.  
  698.     IF KEYPRESSED() THEN GOTO -HAD.KEY
  699.  
  700. Or they can be used in combination with each other:
  701.  
  702.     TYPE The hour is now: LEFT( TIME() 2 )
  703.  
  704. In general, external functions can be very powerful additions to Extended Batch
  705. Language. Registered users receive details of how to add their own custom
  706. additions using external functions. The BAT-BBS will be the repository for all
  707. new functions from other users.
  708. end
  709.       goto -scroll
  710. -opt14
  711. -line1304 %i = 1400
  712. -line1400 %H = "Additional Information" | call -header| begtype
  713.   The size of the keyboard stack defaults to 1024 bytes.  This value can be
  714. changed by making the first statement which is executed by the Extended
  715. Batch Language program be of the form:    BAT * size.  Size is the decimal
  716. number of bytes to reserve for the stack.  This must be executed, for
  717. instance, when a system reset is performed because once this area is
  718. installed, the size is never altered until another system reset.
  719.  
  720.   There are additional variables %A thru %O (oh) which are called "global
  721. user variables".  These variables are used exactly like the variables
  722. supplied by DOS (%0 to %9) with two exceptions.  First, the contents of
  723. these variables are maintained between execution of batch files for as long
  724. as the system is powered on.  This "global" feature is useful for keeping
  725. indicators BETWEEN "sessions" of the user.  Second, because DOS does not
  726. know about these variables, they \0fcannot\07 be used as variables within
  727. any DOS command.  So while "COPY %1 %2" is valid, "COPY %A %B" is not.  If
  728. you wish to use them within DOS commands, they must first be copied via a
  729. statement like "BAT %1 = %A".
  730. end
  731.       goto -scroll
  732. -line1401 call -header | begtype
  733.   PREDEFINED VARIABLES...
  734.  
  735.   A return code is available at memory address [0000:04FE].  If set by a
  736. program, BAT can read this byte value with the variable %R.  The string
  737. stored into this variable is in hex with leading zeros truncated.
  738.  
  739.   The current default drive is stored into the %V variable.  It is a single
  740. character.
  741.  
  742.   The status of the stack is stored into the %Q variable.  It is a "K" if
  743. the READ command will be reading from the keyboard, and a "S" if it will be
  744. reading from the stack area.
  745.  
  746.   There are two character literals.  %S represents a space literal and %%
  747. represents a percent sign.  Either of these special variables can be stored
  748. into other variables, or used for testing special cases.
  749. end
  750.       goto -scroll
  751. -line1402 call -header | begtype
  752. The STATEOF command will search all disk drives for the existence of a file.
  753. The name after the word STATEOF can be a specific name, general name with
  754. wildcard characters (e.g. *.EXE), or it can be a name with a specific drive
  755. specification (e.g. A:PE.EXE). In the last case, only drive A: will be
  756. searched instead of all available drives. Note also that a variable can be
  757. used instead of a file name. In this version of BAT, only files in the
  758. current directory (no paths) can be found.
  759.  
  760. The return code variable %R is used to indicate the result of the search
  761. for STATEOF. The results are:
  762.  
  763.     0 - File found on default drive.
  764.     1 - File not found.
  765.     9 - Invalid file name specified.
  766.     A to D - Same as return code 0 but instead of being found on the
  767.         default drive, it was found on drive A, B, C, or D.
  768. end
  769.       goto -scroll
  770. -line1403 call -header | begtype
  771.   If a you wish to put more than one command on a line, the vertical bar
  772. "|" is useful.  When used with an IF command and the test for the IF
  773. conditions fail, the entire rest of the line will be ignored.  Multiple
  774. commands within a BAT statement is very useful when combined with the IF
  775. command.  For example:
  776.  
  777.     IF %A = abc TYPE this | CALL -that | GOTO -other
  778.  
  779.   If a comment is needed within a BAT program, the "*" (star) character is
  780. useful.  When used after the word BAT, all characters which follow will be
  781. ignored.  For example:
  782.  
  783.     * This is a comment to the programmer.
  784. end
  785.       goto -scroll
  786. -line1404 call -header | begtype
  787.   That's about all the help there is!
  788.  
  789. If you still need more information, you might wish to call the BAT-BBS
  790. hotline at 407/395-2816.
  791.  
  792. Fully registered users will receive a password to the BAT-BBS hot-line to
  793. allow them to get updates, ask questions, and get helpful tips and
  794. examples.  You will also receive many EBL extensions including source code,
  795. examples and samples of all kinds.  In addition, the manual they receive
  796. gives complete descriptions on all available commands with examples of
  797. each.  We feel that user supported software should be a two way street.
  798. With your help, it will work.
  799.  
  800. If you find this program of value, you may purchase it for $49 at the
  801. address below.    For further information, see section 2 of this document.
  802.  
  803.  Seaware Corp.                              406/392-2046
  804.  Post Office Box 1656                          800/634-8188
  805.  Delray Beach, FL 33444
  806. end
  807.     goto -scroll
  808.  
  809. -on.error-
  810.     %e = %e + 1 | if %e > 2 then %L = ? | skip 6
  811.     if %R <> 6 then skip 5
  812.     %G = .goto.
  813.     color 8f |type Loading part 1 ...
  814.     color 07 |type
  815.     leave
  816.     batdoc
  817.  
  818. begtype
  819.  
  820.      Unexpected error \%S%R in line \%S%L !
  821.  
  822.      This batch file was error free when it was distributed
  823.      by Seaware. An error indicates that it was most likely
  824.      modified by someone improperly. To get an updated demo
  825.      diskette send $10 to Seaware directly or call 800/634-8188.
  826.  
  827.  
  828.  
  829.             Seaware Corp.
  830.              Post Office Box 1656
  831.             Delray Beach, FL 33444
  832. end
  833. %G =
  834. %E = 0
  835. exit
  836.