home *** CD-ROM | disk | FTP | other *** search
- ;
- ASK.COM
-
- Size (recs) CRC Version Author/Latest Issue Disk
- 6k (46) 1765 2.2 Richard Campbell 2/91 Z3COM1
-
- 1- Syntax 2- Usage 3- Notes 4- Examples of Use
-
-
- ASK is a version of the MS-DOS utility which allows testing of user input
- in batch files. It is tailored for use with zex/alias/arunz scripts and will
- only run on Z-System (ZCPR3x). You must have the message buffers available
- to make use of this program. Written in BDS-C/Z vs 2.0 with routines from
- Cam Cotrill's CFORZ02.
- :1
- Syntax ASK "text prompt" choices [reg #]
- or ASK @ row col "text prompt" choices [reg #]
-
-
- [reg #] is optional, defaults to 0.
- row, col = coordinates for prompt.
- Regsiters 0-31 can be accessed.
-
-
- The "text prompt" allows the use of the macros %< and %> to set
- upper and lower case prompts.
-
- Converts ^X to its control character equivilant.
- :2
- Usage
-
- ASK uses the register portion of the message buffers to return the users
- choice, so that the FCP (IF.COM) can test for it. ASK also allows the user to
- choose which register will store the input value by specifying the [reg #],
- registers 0-31 may be accessed.
-
- To use the program, simply supply a prompt string enclosed in double quotes
- followed by the single letter choices to choose from. The prompt string may
- include format commands to allow the prompt to be in upper and/or lower case,
- and to insert control characters in the prompt.
-
- To place your prompt anywhere on the screen, supply the '@' (at) character
- after the name, followed by the row #, and column # for the prompt to be
- placed, the rest of the command is the same as stated above.
-
- Pressing any of the following keys: ESC, Control-C, Control-X, or the
- RETURN key, will exit ASK.COM and set REG 0 to 0, and set the error flag to an
- error condition.
- :3
- ASK Notes
-
- a. Vs 2.2 updates (02/15/91, Richard Campbell):
- - fixed bug in zputs() routine in Z3MSG.C that allowed only uppercase
- output.
- - ASK22.LBR includes a C version of the GST02 program GXYMSG.COM, which
- allows the same type of output used in ASK22.COM.
- :4
- Examples of Use
-
- a. ask "b%>ackup, or %<r%>estore: " br
-
- b. ask "y%>our choice - %<abcd%>: " abcd
-
- c. ask "c%>hange to %<dir1:%> or %<dir2:%>?: " 12 1
-
- d. ask @ 12 5 "e%>nter %<A, B,%> or %<C%>: " abc 3
-
- In the case of the last example, the users input will be stored in the ZCPR
- register number 3 instead of 0.
-
- The following is a script used to create the DEL command similar to the
- MS-DOS command, this one checks for a null parameter, and if found, exits with
- the message: "no files.". If it finds a parameter, it displays the message:
- "deleting....", then checks if the parameter is ambiguous, if so, it runs the
- ASK.COM program to display the "Are you sure? (Y/N): " prompt. It then stores
- the users response in register # 0, (if response was valid!), checks register
- 0 for the value of 1, if equal to 1, erases the file. If the parameter was
- not ambiguous, it erases the file.
- Examples of Use - 2/3
-
- sample ALIAS script:
- ;
- ;DEL - MS-DOS style file deletion command
- ;
- if ~null $1
- echo %>deleting....
- if ambig $1
- ask "a%>re you sure? (%<y/n%>): " yn 0
- if 0 1
- era $1
- fi
- else
- era $1
- fi
- else
- echo %>no files.
- fi
- Examples of Use - 3/3
-
- The IF.COM program may have been used in place of ASK.COM, by using the
- INPUT option, e.g.:
-
- if input a%>re you sure? (%<y/n%>):
-
- I find that ASK.COM allows more flexibility in prompt choices by combining
- the input features of IF.COM with the display features of ECHO and the use of
- the Z3 registers.