home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
graphics
/
demos304.zip
/
DEMOSYS.REF
< prev
next >
Wrap
Text File
|
1993-03-13
|
114KB
|
2,718 lines
DEMOSYS.REF Last revised 03/13/93 Page 1
The DEMO System
Wayne Software
113 Sheffield St.
Silver Spring, MD 20910
Fax support: (301) 588-8986
Reference manual
--------------------------------------------------------------------------------
Table of contents
Table of contents ............................................... 1
Command-line options:
DEMOMAKE.EXE .................................................. 5
The DEMO System viewer ........................................ 6
Control card references ......................................... 7
Screen pages .................................................. 8
- filename [ description ] .................................. 8
- *ref [ description ] ...................................... 9
- (GLOBAL) [ description ] .................................. 9
- (GLOBALNC) [ description ] ................................ 10
- (ONCE) [ description ] .................................... 10
- (SETn) [ description ] .................................... 10
- @label [ description ] .................................... 11
/., ./ ..................................................... 11
Statement reference ........................................... 12
+ filename .................................................. 12
Comments .................................................... 12
DATADIR [ subdirectory ] .................................... 12
DO name [ parms ], DO (DUMMY) [ parms ] ..................... 13
MACRO name [ REUSE | SKIP ], MEND ........................... 13
SET statements ................................................ 14
SET BASE n .................................................. 14
SET CASE ON, SET CASE OFF ................................... 14
SET CLS ON, SET CLS OFF ..................................... 14
SET COLOR settings .......................................... 15
SET CURSOR string ........................................... 15
SET KEYS CLEAR .............................................. 16
SET KEYS (SETn) ............................................. 16
SET LOGO string ............................................. 16
SET MONO settings ........................................... 16
SET MOUSE ON, SET MOUSE OFF ................................. 17
SET SETTINGS CLEAR .......................................... 17
SET SETTINGS (SETn) ......................................... 17
SET TOP screen .............................................. 17
DEMOSYS.REF Last revised 03/13/93 Page 2
Action commands:
ASSIGN ^Uvar^ [ = string ] .................................. 18
BEEP ........................................................ 18
BUFFER [ chars ] ............................................ 18
CALL screen [ KEYn | parms ] ................................ 19
CD directory ................................................ 19
CDD drive:directory ......................................... 19
CLS ......................................................... 20
CLSA ........................................................ 20
COPY file1 file2 ............................................ 20
DATA ........................................................ 20
DELETE filename ............................................. 20
DISPLAY COLOR, DISPLAY MONO, DISPLAY TOGGLE ................. 21
DRIVE letter ................................................ 21
DROP location ............................................... 21
ECHO [ string[@] ] .......................................... 22
ECHOA [ string[@] ] ......................................... 22
FIELD [ TOP | FIRST | -999 to 999 | BOTTOM | LAST |
@1 to @99 ] ............................................... 22
GOTO screen [ KEYn | CLEAR | parms ] ........................ 23
HOP location ................................................ 24
IF cond1 rel cond2 THEN HOP location ........................ 25
KEYPRESS .................................................... 25
LOADLOGO ^Uvar^ char_count .................................. 26
LOADLOGO CLEAR .............................................. 27
LOCATE row col .............................................. 27
MD directory ................................................ 27
MSGBOX type message ......................................... 28
MSGBOXA type message ........................................ 28
NONE ........................................................ 29
PAUSE [ seconds ] ........................................... 30
PAUSEA [ seconds ] .......................................... 30
PAUSE BREAK ON, PAUSE BREAK OFF ............................. 30
PAUSE DEMO seconds .......................................... 30
PLAY string ................................................. 31
PLAY ON, PLAY OFF ........................................... 31
POP [ TOP | 1 to 20 ] [ KEYn ] .............................. 32
PROMPT ^Uvar^ "pattern" [ other parms ] ..................... 33
PROMPTA ^Uvar^ "pattern" [ other parms ] .................... 37
QUIT [ return_code ] ........................................ 38
RD directory ................................................ 39
REDRAW ...................................................... 40
RUN [ string ] .............................................. 41
RUNA [ string ] ............................................. 42
SAVE filename ............................................... 42
SCREEN { TOP | FIRST | -999 to 999 | BOTTOM | LAST }
[ KEYn | CLEAR | parms ]................................... 43
SELECT ...................................................... 44
WRITE filename string ....................................... 44
@ ^Uvar^ "pattern" [ other parms ] .......................... 45
DEMOSYS.REF Last revised 03/13/93 Page 3
KEY statement ................................................. 47
Miscellaneous string concepts ................................. 48
&Pn: Variables passed in when invoking DEMOMAKE itself.... 49
&n: Variables passed in when doing DO statements......... 51
^Uvar^: User-defined variables............................... 51
^EVar^: DOS-defined environmental variables.................. 51
%Func%: System-defined functions............................. 52
%Add%(n,n) ................................................ 53
%Col% ..................................................... 53
%Date% .................................................... 53
%DateOrig% ................................................ 53
%DateR2S%(n) .............................................. 53
%DateS2R%(s) .............................................. 53
%DateValid%(s) ............................................ 53
%Dir% ..................................................... 53
%Display% ................................................. 53
%DisplayEGA% .............................................. 53
%DisplayNum% .............................................. 53
%DisplayVGA% .............................................. 53
%Div%(n,n) ................................................ 54
%Drive%(c) ................................................ 54
%DriveCur% ................................................ 54
%DriveDir%(c) ............................................. 54
%DriveDirOrig% ............................................ 54
%DriveLabel%(c) ........................................... 54
%DriveOrig% ............................................... 54
%DriveSpace%(c) ........................................... 54
%FieldMax% ................................................ 54
%FieldNum% ................................................ 54
%FileDate%(s) ............................................. 55
%FileExist%(s) ............................................ 55
%FileJoin%(c) ............................................. 55
%FileMakeTest%(s) ......................................... 55
%FileOrig% ................................................ 55
%FileOrigDir% ............................................. 55
%FileSize%(s) ............................................. 55
%FileTime%(s) ............................................. 55
%FileValid%(s) ............................................ 55
%FreeEMS% ................................................. 56
%Instr%(s,s) .............................................. 56
%Instr2%(n,s,s) ........................................... 56
%Left%(s,n) ............................................... 56
%Len%(s) .................................................. 56
%Lower%(s) ................................................ 56
DEMOSYS.REF Last revised 03/13/93 Page 4
%Mid%(s,n,n) .............................................. 56
%Mouse% ................................................... 56
%Mult%(n,n) ............................................... 56
%PageDesc% ................................................ 57
%PageLines% ............................................... 57
%PageMax% ................................................. 57
%PageName% ................................................ 57
%PageNum% ................................................. 57
%PathCanMake%(s) .......................................... 57
%PathExist%(s) ............................................ 57
%PrinterReady%(n) ......................................... 57
%Proper%(s) ............................................... 57
%ReplaceStr%(s,s,s) ....................................... 57
%Right%(s,n) .............................................. 57
%Row% ..................................................... 57
%Sub%(n,n) ................................................ 58
%Time% .................................................... 58
%TimeElapsed% ............................................. 58
%TimeOrig% ................................................ 58
%TimeR2S%(n) .............................................. 58
%TimeS2R%(s) .............................................. 58
%Trim%(s) ................................................. 58
%Upper%(s) ................................................ 58
%Weekday%(s) .............................................. 58
%1% to %9% ................................................ 58
^ctrl: Control codes ....................................... 59
Primary vs alternate screens ................................ 60
System maximums ............................................... 60
DEMOSYS.REF Last revised 03/13/93 Page 5
--------------------------------------------------------------------------------
Command-line options
DEMOMAKE.EXE syntax:
DEMOMAKE ctlname [ exename ] [ /OVERWRITE | /-OVERWRITE | /OVERASK ]
[ /SCAN ] [ /Xstring ] [ /Lstr ] [ /Q ] [ /? ] [ other parms ]
where:
"ctlname" is the name of the main control file that you want to process. The
main control file can include links to other control files if desired Drive and
path information can be provided if desired.
"exename" is the name of the self-viewing file you want to create. The name
defaults to the ctlname with an .EXE extension. If a name is provided without
an extension, the extension defaults to "EXE". Drive and path information can
be provided if desired.
"/OVERWRITE" says to overwrite the output file if it already exists.
"/-OVERWRITE" says to abort if the output file already exists.
"/OVERASK" says to prompt if the output file exists already. This is normally
the default but you can use the CONFIGWS program to change it.
"/SCAN" is used to have the program review your control files without actually
checking on any of the screen files (either imbedded or external). This does
not produce an EXE file but it's a useful way of quickly reviewing the validity
of your file.
"/Xstring" is used to protect your control file from being regenerated by the
DEMOSAVE program (available to registered users only). The same string has to
be provided when DEMOSAVE is run.
"/Lstr" is a flag that registered users may use which turns off the "Wayne
Software" copyright message.
"/Q" says to not play any of the PLAY commands within the file. Normally, they
are all played during compilation in order to make sure they are valid. In
case you forget, you can also press the letter "Q" during compilation to turn
it off.
"/?" or "/HELP" or "HELP" gives you syntactical information about how to use the
command.
"other parms" are additional values that you want to pass in. These will be
substituted into the strings &P1 to &P9 (if any) found in your control cards or
screen files. Resolution of these parameters is done at compile time, not
viewing time. As such, you can pass in names of macros or anything else. The
case of your parameter is retained. Multi-word parameters can be enclosed in
quotes.
DEMOSYS.REF Last revised 03/13/93 Page 6
The DEMO System viewer syntax:
exename [ /M ] [ /Q ] [ /? ]
where:
"exename" is the name of the self-viewing file created by DEMOMAKE.EXE.
"/M" says to use the monochrome (or alternate) color set. The DEMO System
defaults to the color (primary) set.
"/Q" says to skip all BEEP and PLAY statements.
"/?" or "/HELP" or "HELP" gives you syntactical information about how to use the
command.
DEMOSYS.REF Last revised 03/13/93 Page 7
--------------------------------------------------------------------------------
Control Card References
Descriptions below are separated into five sections:
Screen pages: This includes all GLOBAL and SET page types. It also
includes /. ... ./ used for imbedded text screens.
Statement Reference: Macros and some other commands that don't fit
under the other groups below.
SET statements: Commands which are defined once for every screen page.
Action commands: Commands which can appear on their own in some types
of screen pages or else in KEY commands.
KEY statements: Commands which are activated by the user pressing a
given key on the keyboard.
Miscellaneous string concepts: Things like control codes, variables, and
functions.
Note that within The DEMO System viewer, actions happen in a predictable order.
This order is as follows:
(1) All SET statements are executed. The SET LOGO statement is not acted
upon until later. If SET CLS ON is active, the screen is cleared.
(2) The text screen (if any) is displayed.
(3) The SET LOGO statement (if any) is activated; writing over any text that
is already on the screen.
(4) If a data-entry form is provided (@ commands are used), the data-entry
form is completed.
(5) Any action commands are activated. If your action commands include any
command that clears the screen (like CLS), you'll wipe your text
screen out.
(6) Any KEY commands are activated. This step is not executed if a data-
entry form was provided.
DEMOSYS.REF Last revised 03/13/93 Page 8
--------------------------------------------------------------------------------
Screen Pages
This section documents all of the various types of "pages" within The DEMO
System. All executable commands have to be assigned to a page.
Pages begin with a dash followed by a space. Pages end *only* whenever any of
the following conditions are met:
* The end of the main control file is reached
* Another screen page control statement is reached.
* A QUIT, GOTO, SCREEN, KEYPRESS, or POP action command is encountered.
*******************
- filename [ description ]
Defines a page whose display screen is stored in an external file. The filename
can include drive and path information if desired. Otherwise, the file will be
looked for in your default subdirectory unless a DATADIR statement appears.
Note that even if drive/path information is coded, the related CALL or GOTO
statement should not include this drive/path information.
All filenames (minus drive/path information) must be unique.
Note that the function %PageName% returns the filename and %PageDesc% returns
the page description for this page.
The first screen displayed has to be a display screen, not a label screen.
These pages can include: SET statements
Action commands
KEY statements
DEMOSYS.REF Last revised 03/13/93 Page 9
*******************
- *ref [ description ]
Defines a page whose display screen is imbedded within /. ... ./ lines.
Example:
- *001 Testing
KEY (ESC) POP
/.
Sample screen
^C2 Hi! ^C0
./
The DEMOMAKE program actually requires that all display screens to be stored as
external files. As a result, when it encounters imbedded screens, it
transparently writes them out to your default drive and subdirectory under the
names ~DEMOINT.nnn (where "nnn" is a three-digit number assigned sequentially).
These files are then read back in during the second pass and then deleted. Due
to this, imbedded files have to be processed twice and will be slower to compile
than non-imbedded files.
Having said this, it's much easier to write documentation if the screens are
imbedded so most examples in this document will show imbedded screens.
All references must be unique.
Note that the function %PageName% returns the file reference ("*ref") and
%PageDesc% returns the page description for this page.
These pages can include: SET statements
Action commands
KEY statements
*******************
- (GLOBAL) [ description ]
Allows you to establish default KEY and SET settings. Any KEY or SET statements
that appear before you first screen page are presumed to be within (GLOBAL).
The (GLOBAL) statement automatically resets all previously-defined (GLOBAL) KEY
settings but does not affect any (GLOBAL) SET settings.
The (GLOBAL) statement affects all regular page references which follow it.
You cannot include any action commands within a (GLOBAL) definition.
These pages can include: SET statements
KEY statements
DEMOSYS.REF Last revised 03/13/93 Page 10
*******************
- (GLOBALNC) [ description ]
Identical to the (GLOBAL) reference except it does not clear any
previously-defined (GLOBAL) KEY settings.
These pages can include: SET statements
KEY statements
*******************
- (ONCE) [ description ]
Establishes a set of commands that is only executed once, at the start of the
program. Typically, the use of this is confined to LOADLOGO and associated DATA
statements. For menuing systems, you may find it desirable to put a DELETE
statement in this section.
Note that the (ONCE) page counts as a page and can be used (usually
accidentally) as a destination for SCREEN, CALL, and GOTO commands.
These pages can include: Action commands
*******************
- (SETn) [ description ]
Allows you to establish up to 10 sets of KEY and SET defaults. "n" has to be a
digit from "0" to "9".
The (SETn) KEY settings are invoked by using the "SET KEY (SETn)" command.
The (SETn) SET settings are invoked by using the "SET SETTINGS (SETn)" command.
You have to define the (SETn) before you use it. You can re-specify the (SETn)
settings if you want. You can define (SETn) sections in any order; you don't
have to define (SET0) before you define (SET1).
Action commands appearing within a (SETn) definition are ignored (unlike in
(GLOBAL) definitions where they generate errors).
These pages can include: SET statements
KEY statements
DEMOSYS.REF Last revised 03/13/93 Page 11
*******************
- @label [ description ]
Establishes a page with no associated screen file. Is typically used for
prompt or action-only screens, setting up buffers, etc.
Labels are truncated at 12 characters including the "@" character.
Note that the function %PageName% returns the label ("@label") and %PageDesc%
returns the page description for this page.
The first screen displayed has to be a display screen, not a label screen.
These pages can include: SET statements
Action commands
*******************
/.
...
./
Defines the screen text for any page with imbedded screen text. The "./"
statement must appear by itself on the control line; comments are not allowed.
DEMOSYS.REF Last revised 03/13/93 Page 12
--------------------------------------------------------------------------------
Statement Reference
Statements can basically appear anywhere within the control file.
*******************
+ filename
Says to pick up more control statements from another file. Can include drive
and path information if desired.
*******************
Comments
The DEMO System ignores any blank lines as well as any lines that begin with the
following characters:
: (colon)
; (semi-colon)
' (single quote)
/* (slash-asterisk)
Comments can also be included on lines after regular commands; precede the
comment with "/*" as in:
KEY (ESC) GOTO SCRN.001 /* Takes the user to the main menu
The use of comments is always recommended.
*******************
DATADIR [ subdirectory ]
Specifies the subdirectory location of all file references that follow. This
statement can appear anywhere including within page screen definitions (but not
within the text of the screen). The DATADIR setting remains in effect until
another DATADIR setting is encountered.
If subdirectory is not provided, files will be looked for in your default
subdirectory.
You can always hard-code the paths in all of your file references but it's
easier to use the DATADIR command.
DEMOSYS.REF Last revised 03/13/93 Page 13
*******************
DO name [ parms ]
DO (DUMMY) [ parms ]
Executes a previously-defined Macro statement.
Up to 9 words can be passed in and these will be substituted in for any
references to &1 to &9 during compilation. (If 10 or more words are provided,
the extra words are all stuck in &0.) These variables remain set until another
DO statement is encountered.
DO (DUMMY) is used to clear or reset Macro variables. No action other than the
variable clearing goes on with this Macro statement. You can, therefore, have
&1 to &9 (and &0) defined even without having any associated MACRO statement.
*******************
MACRO name [ REUSE | SKIP ]
...
MEND
Defines a Macro. This code can include any statement other than another Macro
definition. The Macro block must end with a MEND statement, which must appear
by itself on a control line. (The MEND statement can include comments though.)
Macro names must be unique unless "REUSE" or "SKIP" is specified. If the
definition already exists and "REUSE" is specified, the new definition will
replace the old. If the definition already exists and "SKIP" is specified, the
new definition will be ignored (although it does show up in the count of
macros).
The Macro is actually invoked with a DO command.
DEMOSYS.REF Last revised 03/13/93 Page 14
--------------------------------------------------------------------------------
SET Statements
Each SET statement is defined once per display screen. (One exception: SET
KEYS SETn and SET SETTINGS (SETn) can occur multiple times.) If the same SET
statement appears more than once in a given page, the latter definition always
wins. Keep this in mind; you can't have the program be case-sensitive for some
keys and case-insensitive for others on the same screen.
*******************
SET BASE n
Sets the default color (^Cn) to be used for a given screen. "n" has to be
a color set number (0 to 7).
The default setting is SET BASE 0.
*******************
SET CASE ON
SET CASE OFF
Determines whether the case of the user's input matters when processing a KEY
statement. If SET CASE ON is in effect, "g" will be treated differently than
"G".
The default setting is SET CASE OFF.
*******************
SET CLS ON
SET CLS OFF
Determines whether the screen is automatically cleared when a new text screen
(confined to "- filename" and "- *ref" statements) is loaded.
The default setting is SET CLS ON.
DEMOSYS.REF Last revised 03/13/93 Page 15
*******************
SET COLOR settings
Allows you to define up to 8 color "sets" (numbered ^C0 to ^C7) which you can
use in most displayed text. Each color set consists of 1 to 8 three-digit
numbers. The first three-digit number defines ^C0, the eighth defines ^C7.
Each three digit number consists of two digits for a foreground color and one
digit for the background color. The foreground color must be zero-filled if
it's only one digit in length (use "07" instead of "7").
Foreground colors:
Low intensity High intensity
0 = black 8 = dark grey
1 = blue 9 = light blue
2 = green 10 = light green
3 = cyan 11 = light cyan
4 = red 12 = light red
5 = magenta 13 = light magenta
6 = brown 14 = light yellow
7 = white 15 = bright white
Adding 16 to any color will make the text blink.
Background colors can consist of 0 to 7 above.
Bright white on blue, for example, would be "151".
The default setting is SET COLOR 151 154 152 117 097 153 001 157
All screen text lines are defined to use color set 0 unless a different "SET
BASE n" is specified. You can imbed color control codes anywhere in your text
to get around this. The SET COLOR settings automatically come up by default
unless /M is passed into the viewer. You can switch to the monochrome settings
within your program by issuing the command "DISPLAY MONO" or "DISPLAY TOGGLE".
Other than the text screen lines, most text uses the color of the last string
printed as the default color.
*******************
SET CURSOR string
This establishes the shape and color of the screen's cursor. This is typically
applicable only for full-screen operations.
The cursor definition string can include ^ controls. For example:
SET CURSOR ^C2(^T10^
The default setting is SET CURSOR _
DEMOSYS.REF Last revised 03/13/93 Page 16
*******************
SET KEYS CLEAR
Clears any key definitions inherited from the (GLOBAL) level.
*******************
SET KEYS (SETn)
Grabs all KEY settings in (SETn) and uses them for this screen. (SETn) has to
be previously defined.
The settings are added in place, leaving KEY statements before and after as they
were. If the (SETn) KEY setting is already defined before the SET KEYS (SETn)
statement is encountered, the first definition wins. Similarly, KEY statements
which appear after a SET KEYS (SETn) statement lose precedence over the
definitions in SET KEYS (SETn).
See also the SET SETTINGS (SETn) command which grabs all SET settings in (SETn).
*******************
SET LOGO string
Establishes a logo or byline that appears somewhere on the screen. This is
typically used to identify the fact that the person is running a demo, not the
real product. The logo prints over any text that is already on the screen.
The logo string can include ^ controls. This allows you to have the logo
appearing on multiple logo lines on your screen although only one SET LOGO is
accepted. For example:
SET LOGO ^C1^P1,35This is a logo^P25,30appearing on top and bottom
*******************
SET MONO settings
Defines the monochrome (or alternate) screen colors. See the description of
colors in the SET COLOR command description.
In actuality, COLOR and MONO just refers to a primary and secondary set of
screen colors. You could define MONO to be color as well.
The default setting is SET MONO 150 070 007 157 150 070 007 157
DEMOSYS.REF Last revised 03/13/93 Page 17
*******************
SET MOUSE ON
SET MOUSE OFF
Allows the mouse cursor to show up. Usually used in conjunction with a SELECT
action command:
SET MOUSE ON
KEY (MOUSER) SELECT
Defaults to SET MOUSE OFF. Is automatically deactivated if there are no
keyboard input fields defined on the screen or if the screen is a data-entry
form (using @ commands).
*******************
SET SETTINGS CLEAR
Resets most SET commands to their system initial values. These are:
SET BASE 0
SET CASE OFF
SET CLS ON
SET COLOR 151 154 152 117 097 153 001 157
SET CURSOR _
SET LOGO
SET MONO 150 070 007 157 150 070 007 157
SET MOUSE OFF
*******************
SET SETTINGS (SETn)
Grabs all SET settings in (SETn) and uses them for this screen. (SETn) has to
be previously defined.
The settings are added in place, leaving SET statements before and after as they
were. If the (SETn) SET setting is already defined before the SET SETTINGS
(SETn) statement is encountered, the first definition wins. Similarly, SET
statements which appear after a SET SETTINGS (SETn) statement lose precedence
over the definitions in SET SETTINGS (SETn).
See also the SET KEYS (SETn) command which grabs all KEY settings in (SETn).
*******************
SET TOP screen
Determines which screen the system will bring up if a "POP TOP" statement is
executed. Is also the screen that's brought up if a POP statement tries to POP
further back than the CALL stack provides.
Defaults to the first real text screen in your control file.
DEMOSYS.REF Last revised 03/13/93 Page 18
--------------------------------------------------------------------------------
Action commands
ASSIGN ^Uvar^ [ = string ]
Assigns a value to a user-defined variable. The use of the equal sign is
optional.
The assignment string can include user-defined variables, environmental
variables, or functions.
If the assignment string is left off, the value of ^Uvar^ will be null.
*******************
BEEP
Beeps. You can be more creative using PLAY commands though. BEEP is useful if
you want to alert people to invalid keystrokes:
KEY (ELSE) BEEP
*******************
BUFFER [ chars ]
Buffers one or more characters. These characters are then read in when The DEMO
System encounters any keypress situation.
Leaving off the parameter results in the buffer being immediately cleared.
One of the characters can be (LASTKEY) which is the value of the last key
pressed. Passing this then clears the value of (LASTKEY). This is typically
used for screens that you want any keypress to advance to the next screen but
you still want to use the keypress for some later movement.
Buffering is affected by these commands:
PAUSE BREAK ON
PAUSE BREAK OFF
PAUSE DELAY seconds
DEMOSYS.REF Last revised 03/13/93 Page 19
*******************
CALL screen [ KEYn | parms ]
Passes control to another screen (or label) with the intention of having a POP
command later on returning control to the current screen.
The KEYn parameter says to position the cursor at input key "n" when the next
screen in loaded.
The optional parameters allow you to pass up to 9 values into the next screen.
These values are stored separately as functions %1% to %9% unless you pass the
parameters in with quotes. For example:
CALL @TEST1 Internet lives! /* %1%=Internet, %2%=lives, others blank
CALL @TEST2 "Internet lives!" /* %1%=Internet lives!, others blanks
These function remain set until the next CALL, GOTO, or SCREEN statement is
encountered which also passes parameters.
The parms can include control items, user-defined variables, environmental
variables, and functions.
See also the GOTO and SCREEN commands.
*******************
CD directory
Changes the default subdirectory. If that directory does not exist, an error
message will be displayed but the program will continue on.
If the subdirectory includes drive information, the default subdirectory on
*that* drive, not the default drive, will be changed.
The directory can be a user-defined variable or a function.
See also the CDD, DRIVE, MD, and RD commands.
See also the %PathExist% function.
*******************
CDD drive:directory
Changes the default drive and subdirectory. (Essentially the same thing as
issue a DRIVE command, followed by a CD command.) If that directory does not
exist, an error message will be displayed but the program will continue on.
The drive:directory can be a user-defined variable or a function.
See also the CD, DRIVE, MD, and RD commands.
See also the %DriveDirOrig% and %Dir% functions.
DEMOSYS.REF Last revised 03/13/93 Page 20
*******************
CLS
Clears the primary screen.
*******************
CLSA
Clears the alternate screen.
*******************
COPY file1 file2
Copies one file (file1) under another file (file2). The destination file is
replaced if it exists already. Either filename can include drive and path
information.
Either file name can be a user-defined variable or a function.
See also the %FileExist% function.
*******************
DATA ...
Statement which, so far, is only used with the LOADLOGO command.
*******************
DELETE filename
Deletes a file. The filename can include drive and path information. The
command is ignored if the file doesn't exist.
The file name can be a user-defined variable or a function.
See also the %FileExist% function.
DEMOSYS.REF Last revised 03/13/93 Page 21
*******************
DISPLAY COLOR
DISPLAY MONO
DISPLAY TOGGLE
Sets the default color setting to either the SET COLOR set or the SET MONO (or
alternate) set. DISPLAY TOGGLE toggles between the two (COLOR becomes MONO and
vice versa). This is frequently used in a key definition:
KEY (A-M) DISPLAY MONO
KEY (A-C) DISPLAY COLOR
Note that the color changes do not take effect until the screen is redraw. You
may want to handle display toggling in a label since that will redraw the
screen automatically when done.
See also the %Display% and %DisplayNum% functions.
*******************
DRIVE letter
Sets the default drive as "letter". The drive designation *cannot* be an
environmental variable.
See also the CD, CDD, MD, and RD commands.
See also the %Dir% functions.
*******************
DROP location
Establishes a label to which you can later HOP to. The location is a single
word (it cannot contain spaces), is not case-sensitive ("DROP Wayne" is the same
as "DROP WAYNE") and is truncated to 8 characters.
See also the HOP and IF commands.
DEMOSYS.REF Last revised 03/13/93 Page 22
*******************
ECHO [ string[@] ]
Prints a string to the primary screen. The string can include environmental
variables, user-defined variables, functions, and control codes.
If a "@" immediately follows the string, The DEMO System will not do a carriage
return/line feed after the string.
Note that it's possible to cause a system failure by specifying a string that
will not fit within the designated line. Exercise some judgment when putting
long strings on the right side of the screen.
*******************
ECHOA [ string[@] ]
Prints a string to the alternate screen. See the ECHO action command for
further details.
*******************
FIELD [ TOP | FIRST | -999 to 999 | BOTTOM | LAST | @1 to @99 ]
Moves the cursor to a different input field on the current screen. Using -999
to 999, you can specify the field position relative to the current field (-2
takes the cursor back two fields).
Absolute fields can be specified using TOP (or FIRST) and BOTTOM (or LAST) or by
specifying @1 to @99.
This command is typically used when designing full-screen systems. For example:
KEY (RIGHT) FIELD 1
KEY (LEFT) FIELD -1
KEY (HOME) FIELD TOP
KEY (END) FIELD BOTTOM
The command is ignored if you have less than two input fields on a given screen.
See also the %FieldNum% and %FieldMax% functions.
DEMOSYS.REF Last revised 03/13/93 Page 23
*******************
GOTO screen [ KEYn | CLEAR | parms ]
Passes control to another screen (or label) with the intention of *not*
returning control to the current screen.
The KEYn parameter says to position the cursor at input key "n" when the next
screen in loaded.
The CLEAR parameter says to clear the CALL return stack when the jump is made.
The optional parameters allow you to pass up to 9 values into the next screen.
These values are stored separately as functions %1% to %9% unless you pass the
parameters in with quotes. For example:
GOTO @TEST1 Internet lives! /* %1%=Internet, %2%=lives, others blank
GOTO @TEST2 "Internet lives!" /* %1%=Internet lives!, others blanks
These keys remain set until the next CALL, GOTO, or SCREEN statement is
encountered which also passes parameters.
Note that a GOTO statement on its own (outside a KEY statement) will result in
the current screen being closed and must be followed by a new page declaration
or else the end of the file.
The parms can include control items, functions, user-defined variables, and
environmental variables.
See also the CALL and SCREEN commands.
DEMOSYS.REF Last revised 03/13/93 Page 24
*******************
HOP location
The HOP command transfers you to the location of a DROP command elsewhere in the
page. In this format, the HOP is unconditional; it will happen no matter what.
It also also non-returnable; the location from which you hopped from is not
stored so the program will not return you to it. You can of course set up some
additional DROP and HOP commands to take care of that.
Care should be take to avoid leaving yourself in an endless loop condition.
There is no way to get out of these without rebooting your machine.
An example of using HOP in combination with the IF command follows:
- @Demo_Loop Demonstration of HOP/DROP/IF etc
; This could have been done using a form too. It wouldn't have
; worked as smoothly using regular text pages because the page
; commands would be executed *before* the user picked their selection.
DROP Start
ECHO We have three tunes that we can play for you:
ECHO 1. Beethoven's Fifth Symphony (abbreviated version!)
ECHO 2. Meaningless drivel 1
ECHO 3. Meaningless drivel 2
ECHO Q. Quit this stuff
ECHO Select one:
PROMPT ^UPlay^ "!" DEF=1 TEST=%Instr%(123Q,^UPlay^) > 0
IF ^UPlay^ = 1 THEN HOP Song1
IF ^UPlay^ = 2 THEN HOP Song2
IF ^UPlay^ = 3 THEN HOP Song3
ECHO Yeah, I'm kind of tired of them too.
HOP Done
DROP Song1
ECHO You picked the only good one!
PLAY mb t180 o2 p2 p8 l8 ggg l2 e- p24 p8 l8 fff l2 d
HOP Start
DROP Song2
PLAY mb l8 n42 n45 n41 n40 n51 n59 n68 n70 n73 n30
ECHO Chear up. Drivel 2 was worse.
HOP Start
DROP Song3
PLAY mb l16 n50 n51 n50 n51 n50 n52 n54 n55 n52 n51 n50 n48 l2 d
HOP Start
DROP Done
QUIT
See also the DROP and IF commands.
DEMOSYS.REF Last revised 03/13/93 Page 25
*******************
IF cond1 rel cond2 THEN HOP location
The IF command provides a way for doing conditional looping in a program. The
command can be used to hop to another statement in the existing page. The
command's scope is limited to a single page.
The "cond1 rel cond2" portion of the command is the same as the TEST= parameter
in the PROMPT command. See that for an explanation of these parameters.
The "HOP location" portion of the command tells it to HOP to the designated DROP
location if the condition is true. That DROP location can be before any
command, including a CALL or GOTO statement so you can go to another screen.
The IF command has many uses. The following example shows it being used to loop
through a section of code 10 times:
- @Test
ECHO This statement should loop 10 times
ASSIGN ^UVal^ = 1
DROP ReLoop
ECHO Current value ^UVal^
ASSIGN ^UVal^ = %ADD%(^UVal^,1)
IF ^UVal^ <= 10 THEN HOP ReLoop
QUIT
Care should be take to avoid leaving yourself in an endless loop condition.
There is no way to get out of these without rebooting your machine.
See also the DROP, HOP, and PROMPT commands.
*******************
KEYPRESS
Pauses and waits for a user input. KEYPRESS is automatically executed for a
screen with an associated text page.
Note that a KEYPRESS statement on its own (outside a KEY statement) will result
in the current screen being closed and must be followed by a new page
declaration or else the end of the file.
Example:
- @TESTING
KEY (UP) ECHO Pressed UP
KEY (DOWN) ECHO Pressed DOWN
KEY (ESC) QUIT
ECHO Press either UP or DOWN or ESC
KEYPRESS
(Remember that action commands are always executed before KEY statements so the
ECHO will show up, then the KEYPRESS will be acted upon, and the result will
be used by the KEY statements.)
DEMOSYS.REF Last revised 03/13/93 Page 26
*******************
LOADLOGO ^Uvar^ char_count
DATA ...
DATA ...
A technique for loading graphics characters over the VGA character set so you
can make things like logos or special boxes while within the text environment.
The technique itself has been explained in several technical articles and
involves the use of interrupts and such. It will not be explained here other
than the explain the format used within this program.
The ^Uvar^ parameter is the user-defined variable that will be assigned the
characters that constitute the redefined characters. If you want to define
several logos, each of which can consist of one or more characters together, you
would need to use several LOADLOGO statements. Once the logo has been loaded,
you can use the ^Uvar^ in ECHO, SET LOGO, etc statements.
The char_count indicates how many characters put together constitute this logo.
There has to be one DATA line for every character.
The DATA statements consist of 17 values. The first value is the ASCII value
that the character will replace (e.g. 211 for CHR$(211)). The next values are
the decimal representation for each line of pixels. VGA fonts are 16 pixels
high so there are 16 values after the decimal representation.
The DATA statements must immediately follow the LOADLOAD statement. Blank
lines and comments are not allowed.
The following example defines a bat silhouette as ASCII characters 221, 222, and
224.
LOADLOGO ^UBatSymbol^ 3
DATA 221,0,24,28,60,62,63,127,127,127,255,255,255,239,206,132,128
DATA 222,66,126,126,126,126,255,255,255,255,255,255,255,255,126,60,24
DATA 224,0,24,56,60,124,252,254,254,254,255,255,255,247,115,33,1
LOADLOGO is ignored if the user does not have a VGA card. In that case, the
environmental variable will be set to null.
You typically will not want to define the logo multiple times in one program.
Doing so causes the screen to flicker. It's usually best to use the (ONCE)
screen definition to load the logo when The DEMO System viewer is loaded and
then not do it again.
Some applications (like PC Tools and the Norton Utilities) may redefine the
character set on their own. In this case, the environmental variable will still
be set but it will display weird characters instead of what you want. Notice
which programs do this and isolate the RUN commands that are affected. If you
have a command like SET LOGO which uses the logo, you will want to either
re-load the logo again (using the LOADLOGO command) or redefine the
environmental variable to be null.
See also the %DisplayVGA% function.
DEMOSYS.REF Last revised 03/13/93 Page 27
*******************
LOADLOGO CLEAR
This command clears any VGA character redefinitions that you've made. This
insures that the user's DOS session won't have weird little graphics characters
showing up at odd times.
If the characters actually remain on the screen after LOADLOGO CLEAR is issued,
you will probably want to issue a CLS command to clear the screen.
LOADLOGO CLEAR does not affect the contents of the environmental variable you
defined in the LOADLOGO command. If you print that string after using LOADLOGO
CLEAR, that string will show up as the original DOS characters, not the
redefined ones. You may want to assign it to null if you want to continue on.
The LOADLOGO CLEAR statement is ignored if the user does not have a VGA card or
if they didn't set any symbols in the first place.
*******************
LOCATE row col
Positions the cursor at a given row and column on the screen. Positioning on
the screen starts with the upper left corner being 1, 1 and the lower right
corner being 25, 80.
Optionally, you can use a comma between the positions.
You can use the ^Prow,col control codes to position most text instead of using
the LOCATE command.
*******************
MD directory
Makes a new subdirectory. If that subdirectory cannot be created, an error
message will be displayed but the program will continue on.
The directory can be a environmental variable, user-defined variable, or
function and it can include drive information if desired.
See also the CD, CDD, DRIVE, and RD commands.
See also the %PathCanMake% function.
DEMOSYS.REF Last revised 03/13/93 Page 28
*******************
MSGBOX type message
Displays a message box on the screen, pausing until the user presses a key.
The message can be purely informational or it can present warnings or force the
user to stop. The "type" code determines the display and the options available
to the user:
0 = informational message only, using color set 1, with only option
being to contiue
1 = warning message, using color set 2, with only option being to
continue
2 = warning message, using color set 2, with option of continuing or
quitting
3 = fatal message, using color set 2, with only option being to quit
The "message" can be any one line of text. Any message longer than 75
characters will be truncated to the first 75 characters. Do not put quotes
around the text.
If the user gets a type 2 message and asks to quit, The DEMO System will set the
DOS return code to be 254. If the user gets a type 3 message, The DEMO System
will set the DOS return code to be 255.
*******************
MSGBOXA type message
Identical to the MSGBOX command except output goes to the alternate screen
instead of the primary screen.
DEMOSYS.REF Last revised 03/13/93 Page 29
*******************
NONE
This is a special null-operation command which is typically only used in
KEY statements. The purpose is to nullify a key assignment made by a (SETn) or
GLOBAL statement.
For (SETn) statements, the NONE assignment has to be made *before* the SET VARS
SETn statement.
Example:
- (GLOBAL)
KEY (UP) FIELD -5
KEY (DOWN) FIELD 5
... (a half-dozen key assignments you like) ...
- (SET1)
KEY (LEFT) FIELD -1
KEY (RIGHT) FIELD 1
... (a dozen key assignments you like) ...
- *001 Testing
KEY (UP) NONE /* Note that these keys will do nothing now
KEY (DOWN) NONE
SET KEYS (SET1)
DEMOSYS.REF Last revised 03/13/93 Page 30
*******************
PAUSE [ seconds ]
Waits for either the specified number of seconds or until the user presses any
key. Seconds can be expressed in tenths and must be between 0.1 and 600.
The activity is done on the primary screen.
*******************
PAUSEA [ seconds ]
Same as "PAUSE [ seconds ]" but activity is done on the alternate screen.
*******************
PAUSE BREAK ON
PAUSE BREAK OFF
Determines whether someone can escape (using the Esc key) out of a self-running
demo.
Defaults to PAUSE BREAK ON (the user can escape out).
*******************
PAUSE DEMO seconds
Determines how many seconds the system should delay between buffered keystrokes
in a self-running demo. The user can skip through the pause by pressing any
keyboard key (not mouse key).
Seconds can be expressed in tenths and must be between 0.1 and 600.
Defaults to PAUSE DEMO 1.
DEMOSYS.REF Last revised 03/13/93 Page 31
*******************
PLAY string
The PLAY command plays a string of sounds using QuickBASIC's PLAY command.
There are lots of characters that can appear in the PLAY string. The following
chart summarizes them but you should use a QuickBASIC manual for fuller
explanations if necessary. (This information doesn't appear in the VisualBASIC
manual at all!)
A to G Plays note in range A to G: "#" after note implies
a sharp while "-" afterward implies a flat
L n Sets the default length of each note (from 1 [whole
note] to 64 [very short note]). You can also specify
the length after each note itself, e.g. "A16".
MN Music normal. Each note plays for 7/8's its time.
ML Music legato. Each note plays for full period.
MS Music staccato. Each note plays 3/4 of its time.
P n Specifies a pause of length 1 to 64.
T n Specifies tempo (number of L 4 quarter notes played
in one minute). Range can be 32 to 255, default 120.
MF Music foreground. The program waits until the notes
finish before going on.
MB Music background. The notes start playing and the
user can continue to press keys while the music plays.
MB is the default in The DEMO System.
. A period after the note causes the note to play
3/2's of it's time.
# or + These characters after the note cause it to be sharped.
- A minus after the note causes it to be flatted.
N n Plays note "n". "n" must be between 0 (a rest) and 84
(the highest note in the seventh octave).
The first few notes of Beethoven's Fifth Symphony is the following:
PLAY mb t180 o2 p2 p8 l8 ggg l2 e- p24 p8 l8 fff l2 d
PLAY strings are played during compilation in order to check them for errors.
You can turn off this verification by using DEMOMAKE's /Q option or else by
pressing Q during compilation. Note that failure to verify the PLAY strings at
some point may result in non-recoverable execution errors.
If your user wants to avoid the PLAY commands, they can call your self-viewing
file with the /Q option and that will turn off all PLAY and BEEP commands.
*******************
PLAY ON
PLAY OFF
The PLAY OFF command turns off any BEEP and PLAY commands within your
demonstration. The PLAY ON command turns them back on.
PLAY ON is the default.
DEMOSYS.REF Last revised 03/13/93 Page 32
*******************
POP [ TOP | 1 to 20 ] [ KEYn ]
Returns to the statement after a prior CALL statement. Relative to GOTO
statements, POP commands make screen levels easier to keep track of and allows
you to designate some screens or sets of screens as being common to several
demonstrations.
You can instruct POP to return you to any of the last 20 screens that you made
CALL's from. You can also instruct it to return to the screen defined as your
"top" screen (see SET TOP), whether that screen had used a CALL or not. If no
level is specified, POP 1 is the default.
You can specify which keyboard input item the cursor should rest on by using the
KEYn parameter. Otherwise, the program will automatically select the first item
on the screen. For example:
- *001 Central menu
KEY (LEFT) FIELD -1
KEY (RIGHT) FIELD 1
KEY @1 CALL @002
KEY @2 CALL @003
KEY @3 CALL @004
KEY (ESC) QUIT
/.
Select one: ^K First field ^K Second field ^K Third field
or (ESC) to quit
./
- @002 First field
ECHO ^P10,1^C1Made it to ^C4first^C1 field's choice
ECHO Press a key
PAUSE
POP /* Returns to first field by default
- @003 Second field
ECHO ^P10,1^C2Made it to ^C4second^C2 field's choice
ECHO Press a key
PAUSE
POP KEY2 /* Will return user to the "Second field" field
- @004 Third field
ECHO ^P10,1^C3Made it to ^C4third^C3 field's choice
ECHO Press a key
PAUSE
POP KEY3 /* Will return user to the "Third field" field
Unlike with GOTO and CALL, you cannot pass a variable or function (like
KEY%Field%) into a POP command.
Doing a POP from the TOP level is the same thing as QUIT.
Note that a POP statement on its own (outside a KEY statement) will result in
the current screen being closed and must be followed by a new page declaration
or else the end of the file.
DEMOSYS.REF Last revised 03/13/93 Page 33
*******************
PROMPT ^Uvar^ "pattern" [ LEN=n ] [ RANGE=n-n ] [ DEF=s ]
[ TEST=cond [rel cond] ] [ QUIT=key ] [ VQUIT=key ] [ HELP=key ]
[ COLOR=n ] [ REQ ] [ NOESCAPE ] [ QUIET | -QUIET ]
The PROMPT command allows you to ask the user for a response. This response is
put into a user-defined variable which can then be displayed, written to a file,
etc. The prompt itself appears on the primary screen (see the PROMPTA command).
The PROMPT command and the related form entry @ command consists of two required
parts and several optional parameters. Each is documented separately below:
"^Uvar^" is a required parameter. It provides the name of user-defined variable
that you want the user's response to be assigned to. The choice of variable
names matters somewhat since any user error messages identify the field by the
variable name.
"pattern" is a required parameter. It tells the system the number of and what
sort of characters the user can enter. The pattern must be enclosed in quotes
and can consist of any combination of the following characters:
A alpha input (A-Z) (either upper or lower case)
B Boolean input (T/F/Y/N; translated to Y/N on output)
N numeric input (digits 0 to 9 only)
U uppercase alpha (A-Z) only (translated to uppercase
if provided in lowercase)
X any character (decimal 32 to 125) (no translation)
! uppercase any character (decimal 32 to 125) (translated
to uppercase if provided in lowercase)
0 to 9 used to indicate a repetition factor for the pattern
that immediately follows the last contiguous digit;
10X is the same as XXXXXXXXXX
else any other characters in the pattern are left in the
result verbatim; quotation marks are not allowed
"LEN=n" is an optional parameter. It tells the system that the user's response
must consist of at least a certain number of characters. (The maximum number of
characters is always the length of the pattern.) If no LEN is specified, it
defaults to LEN=0. The length is determined as the user input, including all
patterns, minus any trailing spaces. The following example would have a length
of 10 even if the user didn't fill in anything because the "-" character is the
10th character of the pattern:
PROMPT ^UPhone^ "(999) 999-9999" LEN=14
The following PROMPT would require that the user's response be at least 3
characters. If they keyed in none, one, or two characters, an error message
would appear (on the secondary screen) and they'd be reprompted for their input:
PROMPT ^UName^ "9!" LEN=3
DEMOSYS.REF Last revised 03/13/93 Page 34
"RANGE=n-n" is an optional parameter. It is primarily used to numeric input,
requiring that the user's input be within a given minimum to maximum range. If
the PROMPT pattern does not include an "N" (numeric) field, then the system
compares the range as strings; otherwise the results are converted to numeric
values and compared that way. If no RANGE is specified, no range test is
applied. Invalid range messages appear on the secondary screen and the user is
re-prompted. The following PROMPT would require that the user enter a number
between 1 and 100:
PROMPT ^UValue^ "NNN" RANGE=1-100
"DEF=s" is an optional parameter. It specifies the default value for the user's
response; the value that will appear in the answer grid. The assignment string
can include a function if you want (e.g. "DEF=%Today%"). If no DEF is
specified, a null value will be the default. For example, the following PROMPT
lets the user specify the drive that they want to copy a file to, defaulting to
drive C:
PROMPT ^UDrive^ "U" DEF=C
"TEST=cond1 rel cond2" is an optional parameter. It allows you to establish a
condition that the user's response must meet before you allow them to continue.
The TEST parameter is a powerful and simple way to have the system impose a
check on the values; you can always have your own control files impose other
checks using IF commands but that's somewhat tougher to do. The TEST parameter
consists of one to three parts. A typical usage might be as such:
PROMPT ^UDrive^ "U" DEF=C TEST=%Drive%(^UDrive^) = 1
This example allows the user to enter a drive letter and then tests to see if
it's a valid drive or not. The %Drive% function (documented in the Functions
discussion below) returns a "0" if the passed-in drive letter is invalid or "1"
if it's valid. In the above example, if the drive does not exist (a "0" value
is returned), the system will beep and the user will be asked for the response
again. Each TEST parameter must be separated by a space and the parameters
themselves cannot include spaces. The "rel" (relation) parameter can consist of
any of the following one- and two-character symbols (whose meaning should be
obvious):
= < > <= >= <>
In addition, you can use these two-letter codes which mean the same thing:
EQ LT GT LE GE NE
The second condition ("cond2") can be "(NULL)", which tests to see if the first
condition ("cond1") is missing or not. For example, to force the user to put in
a valid (although not necessarily existing) file name, the PROMPT would be:
PROMPT ^UFileName^ "25!" TEST=%FileValid%(^UFileName^) <> (NULL)
DEMOSYS.REF Last revised 03/13/93 Page 35
If the user keys in a non-valid file name, the "cond1" parameter will be set to
null. In this format, the TEST rejects any input that evaluates to a null
string so the system beeps and the user is asked for the input again. Check
each function description to see what conditions will result in a null response;
most functions that return numeric values return a 0 or -1 if something's
invalid, most functions that return strings return a null.
The comparison is done based on either the numeric value of the parameters or
their ASCII value. If either parameter can be clearly identified as being
non-numeric, the test will be done on an ASCII basis. So "TEST=2 < 10" will be
true whereas "TEST=2A < 10A" will be false.
Any error message about a TEST= failure appears on the secondary screen even if
PROMPTA is being used.
Note that there can't be a space within any of the TEST parameters, there can't
be a space after TEST=, and there has to be a space between the three
parameters.
"QUIT=key" is an optional parameter. It is typically only used in data-entry
form screens. It indicates the single keypress that will get the user out of
this particular form. The keypress is not case sensitive. The default is
QUIT=(NONE) for every field in the form. There has to be at least one QUIT= or
VQUIT= (see) specification in any form. If the QUIT= key is entered, the value
of the variable will be the upper case value of the QUIT= key. See the example
in the VQUIT=key discussion.
"VQUIT=key" (verify quit) is an optional parameter. It is typically only used
in data-entry forms screens. It indicates the single keypress that will get the
user out of this particular form, and, unlike with the QUIT=key parameter, will
actually verify each of the fields to make sure that all REQ, TEST=, LEN=, and
RANGE= conditions are met. The keypress is not case sensitive. The default is
VQUIT=(NONE) for every field in the form. There has to be at least one QUIT=
(see) or VQUIT= specification in any form. If the VQUIT= key is entered, the
value of the variable will be the upper case value of the VQUIT= key.
The following example shows a typical prompt using QUIT= and VQUIT=. It is
coded for the @ command instead of PROMPT/PROMPTA:
- *Submit? Ask them for a report number and then verify?
@ ^UReport^ "NNN" RANGE=1-175
@ ^UWidth^ "NNN" RANGE=40-132
' Someone could press Tab or Shift-Tab and skip either prompt.
' This is desirable if they don't want a report at all but not
' if they do. So force verification if they say "Y".
@ ^USubmit^ "!" QUIT=(ESC) VQUIT=Y
/.
Select a report number: ^K
Select the desired width: ^K
Correct (Y,N,Esc): ^K
./
DEMOSYS.REF Last revised 03/13/93 Page 36
"HELP=key" is an optional parameter. If the user presses the designated key,
the bottom line of the screen will show some information about what the user
response has to be. It shows the following:
* The pattern
* The minimum length
* The value range
* The default value
* Whether the field is marked REQ or not
* Whether a TEST condition is imposed (but not what the condition is)
* The QUIT= value for this field
* The VQUIT= value for this field
You can define the "key" to be any standard The DEMO System key. It defaults to
KEY=(A-F1).
"COLOR=n" is an optional parameter. It specifies the color setting to use for
the user's input. The "n" parameter corresponds to the normal "^Cn" control
statements and must be in the range of 0 to 7. If no COLOR is provided, the
prompt defaults to COLOR=1. To make a prompt is color set 2, you'd say this:
PROMPT ^UDrive^ "U" DEF=C COLOR=2
"REQ" is an optional parameter. It specifies that an answer must be provided
for this prompt if the cursor is in this field. The answer can be provided by a
DEF=s specification or by a user input. Typically, the user can just press
Enter at a prompt and, unless a DEF=s or LEN=n value is specified, the result
can be null. The REQ parameter reprompts the user if the value is null. Even
with the REQ attribute, it is possible for a user to skip a field entirely by
using Shift-Tab or Tab and going to a designated QUIT=key or VQUIT=key field.
However, if the VQUIT=key key is entered, the system will still force them to
fill in every "REQ"-designated field.
"NOESCAPE" specifies that (C-J) and (C-C), which are normally defined as being,
respectively, shell to DOS and quit to DOS, are not to be valid. This prevents
the user from escaping out of this form except through successful filling in of
the field (in the case of the PROMPT and PROMPTA commands) or successful
execution of the QUIT= key (in the case of the @ command).
"QUIET" turns off the "Insr"/"Over" indicator at the bottom of the screen. This
is the default for the PROMPT/PROMPTA command.
"-QUIET" turns on the "Insr"/"Over" indicator at the bottom of the screen. This
is the default for the @ command.
You should use the ECHO command to generate any message that you want the user
to see before the prompt. For example:
ECHO ^C2Please enter your name? @
PROMPT ^UName^ "U25X" LEN=5 COLOR=3 REQ
DEMOSYS.REF Last revised 03/13/93 Page 37
During data entry, several special data-entry keys can be used. In the
discussion below, "single pattern" refers to patterns which are made up of the
same pattern character like "X" or "XXXX" or "25X". "XXX-XXX-XXX" is not a
single pattern character. Typically, insert and delete only work in single
pattern fields and cursor movement keys skip over non-pattern characters (like
"-" in the example above). The list of special data-entry keys:
(ENTER), (TAB) Ends data entry for this field. If you're in a
data-entry form, moves the cursor to the start of
the next field.
(S-TAB) Ends data entry for this field. If you're in a
data-entry form, moves the cursor to the start of
the previous field
(INS) Toggles insert mode. Is only applicable for fields
that are made up of the same pattern character; you
can't insert into a pattern "XXX-XXX-XXX". Unless
QUIET is in affect, the status line changes from "Over"
to "Insr" as you toggle this.
(BS) Deletes the character in the current position and then
moves back a character.
(DEL) Deletes the character in the current position without
moving the cursor.
(LEFT) Moves the cursor back one character.
(RIGHT) Moves the cursor forward one character.
(C-C) Quits to DOS unless NOESCAPE specified.
(C-F1) Displays the page file name on the bottom line.
(C-J) Jumps to DOS unless NOESCAPE specified. Note that the
screen is not redrawn when you return from DOS so
navigating around a form may get complex.
otherwise Entered into the field.
For PROMPT and PROMPTA, the cursor does not do a carriage return/line feed after
a prompt. If you want one, you have to add an ECHO command on your own.
Unless the QUIET option is in affect, the "Over" and "Insr" indicators appear in
line 25, beginning column position 75. If you use PROMPT, PROMPTA, or the @
command, text located in that position will get overwritten.
See also the PROMPTA and @ commands.
*******************
PROMPTA ^Uvar^ "pattern" [ LEN=n ] [ RANGE=n-n ] [ DEF=s ] [ COLOR=n ]
[ REQ ] [ HELP=key ] [ QUIT=key ] [ TEST = cond1 [ rel cond2 ] ] [ NOESCAPE ]
Identical to the PROMPT command except the prompt appears on the alternate
screen. Note that invalid data user error messages also show up on the
alternate screen.
See also the PROMPT and @ commands.
DEMOSYS.REF Last revised 03/13/93 Page 38
*******************
QUIT [ return_code ]
The command causes the program to stop and return to DOS. Every control card
file should consist of at least one QUIT statement and, by default, (C-C) is
always defined to do this.
The use of the return code (which can be a variable or function) allows you
to use The DEMO System in sophisticated ways within a batch file. For example,
let's say you have a menu system set up where some options will jump to DOS and
run a batch command and return to The DEMO System, while other options will not
return. You could set up some options in The DEMO System to set the return code
as 1 (run an application defined in the batch file DOIT.BAT and then come back),
2 (run DOIT.BAT but don't come back), and 3 (normal end; person wanted out of
the system). If The DEMO System blows up (e.g. you request a prompt that can't
possibly fit in the space allocated), The DEMO System itself will return an
errorlevel of 0. Unfortunately, this is how it works in QuickBASIC and
VisualBASIC and I can't change that. So the complete batch file might look like
this:
:Restart
MYDEMO (or whatever you call your demonstration program)
IF ERRORLEVEL 3 GOTO :Goodbye
IF ERRORLEVEL 2 GOTO :NoReturn
IF ERRORLEVEL 1 GOTO :Return
ECHO Fatal error in The DEMO System
ECHO Check your control cards!
GOTO :Done
:Return
CALL DOIT.BAT
GOTO :Restart
:NoReturn
DOIT.BAT (since CALL not used, will execute the batch file
and then stop; no need for a GOTO afterward)
:Goodbye
ECHO All done!
:Done
Having said all this, creating files and then testing for them with an IF EXIST
statement in your DOS batch file is probably easier.
DEMOSYS.REF Last revised 03/13/93 Page 39
If you loaded any VGA text definitions (using the LOADLOGO command), you may
want to issue a LOADLOGO CLEAR command before quitting.
Upon exit, QUIT leaves the cursor wherever it was last placed. You may want to
issue a LOCATE command (or an ECHO command with ^Prow,col specification) before
exiting. This is typically done by adding a statement like this before QUIT:
ECHO ^P23,1^C1Thank you for your interest in our product!
Note that a QUIT statement on its own (outside a KEY statement) will result in
the current screen being closed and must be followed by a new page declaration
or else the end of the file.
See also the MSGBOX and MSGBOXA action commands.
*******************
RD directory
Removes a subdirectory. If that directory does not exist or it cannot be
removed, an error message will be displayed but the program will continue on.
The directory can be an environmental variable, user-defined variable, or
function. It can contain drive information if desired.
See also the CD, CDD, DRIVE, and MD commands.
See also the %PathExist% function.
DEMOSYS.REF Last revised 03/13/93 Page 40
*******************
REDRAW
Redraws the current text screen without branching. Redrawing is frequently
necessary if you want to recover from the output of a RUN command. The
branching consideration means that, unlike with SCREEN 0 (another way to
accomplish the screen redrawing desire), control will continue with the
statement after REDRAW, instead of re-starting at the first statement of the
screen.
Note that REDRAW affects only screens with attached text screens. It doesn't do
much good for label pages.
An example:
- *002 Sample
KEY A GOTO *003
KEY (ESC) QUIT
/.
Press A or (ESC)
./
- *003
ECHO Testing and press ENTER
PAUSE
REDRAW /* This redraws the screen text (the two lines
/* in the /. ... ./ section below)
RUN DIR *.EXE /W
ECHO Press ENTER
PAUSE
REDRAW
RUNA DIR *.BAS /W /* Doing output to the alternate page
ECHOA Press ENTER
PAUSEA
ECHO Press ENTER again
PAUSE
/.
This is some additional text that keeps coming
up when REDRAW is used but the other stuff doesn't
./
POP /* Remember, this has to be *after* the /. ... ./
DEMOSYS.REF Last revised 03/13/93 Page 41
*******************
RUN [ string ]
Shells to DOS and executes a command (given by "string") in the primary screen.
If the command is not specified, you will be shelled to DOS and left at the DOS
prompt. Say "EXIT" and press ENTER to return to The DEMO System.
The string can be a regular DOS command, any command that's available in your
path, a command with drive and path information if necessary, or the name of a
batch file. The latter is used if you want to execute multiple commands at
once.
RUN leaves a copy of The DEMO System in memory and requires loading COMMAND.COM.
Together, these take up roughly 130K of RAM space. If the remaining space is
not sufficient to run your application, consider using The DEMO System as part
of a batch file, quitting entirely to DOS, running your application, and then
reloading The DEMO System. Techniques for doing this are discussed in
DEMOSYS.DOC under the "Creating menuing systems" section.
Typically, after running the command, your display screen will be messed up.
You may want to use any command that will redraw the current screen (REDRAW or
CLS) or else branch you to another screen (SCREEN, GOTO, CALL, POP) immediately
after doing a RUN command.
The command string can include environmental variables, user-defined variables,
or functions if desired.
You can also add a ">NUL:" at the end of the command string in order to try to
eliminate the screen output from the RUN command. This doesn't always work.
See also the RUNA command.
DEMOSYS.REF Last revised 03/13/93 Page 42
*******************
RUNA [ string ]
Similar to the RUN command except the commands are executed in the alternate
screen (instead of the primary screen) and the alternate screen is also made the
default screen for viewing the results. This provides a way of running a batch
or DOS command without interfering with existing menus.
Some applications will change the default screen and wipe out your primary
screen anyway. This is typically not the case with any internal DOS commands
but it may be a factor with others. In these cases, you might as well use RUN
instead.
The command string can include environmental variables, user-defined variables,
or functions if desired.
*******************
SAVE filename
Saves the current screen to a file. This is desirable in some cases (maybe the
current screen has an application form and you want the user to be able to print
or save it).
"Filename" can by any file (including drive and path information if desired) or
be any of the following DOS devices:
KYBD:
SCRN:
COM1: to COM4:
LPT1: to LPT2:
CONS:
The filename can include environmental variables, user-defined variables, or
functions if desired.
DEMOSYS.REF Last revised 03/13/93 Page 43
*******************
SCREEN { TOP | FIRST | -999 to 999 | BOTTOM | LAST } [ KEYn | CLEAR | parms ]
Branches the program to another screen or page using an implied GOTO command.
In most cases, SCREEN and GOTO can be used synonymously (and, in fact, SCREEN
commands are internally recoded as GOTO commands). SCREEN avoids the need to
hardcode a series of screen names when you want to execute them in a sequence.
For example:
- EXPLAIN.001 First screen
KEY (PGDN) SCREEN 1
KEY (ESC) QUIT
- (GLOBAL)
KEY (PGDN) SCREEN 1
KEY (PGUP) SCREEN -1
KEY (ESC) QUIT
- EXPLAIN.002 Second screen
- EXPLAIN.003 Third screen
- EXPLAIN.004 Fourth screen
- (GLOBAL)
- EXPLAIN.005 Last screen
KEY (PGUP) SCREEN -1
KEY (PGDN) NONE
KEY (ESC) QUIT
You can specify screen locations in relative terms using positive numbers to
move to the next screens in sequence and negative numbers to move to the prior
screen. Note that the program does not distinguish text screens from label
screens when it's doing this movement; if you want to avoid a label, make sure
the label is not in the sequence you want to pass through.
You can also specify SCREEN TOP (or SCREEN FIRST) and SCREEN BOTTOM (or SCREEN
LAST) to take the user to the absolute first screen (*not* the one defined by
SET TOP; use "POP TOP" to do this) or the absolute last screen.
The KEYn parameter says to position the cursor at input key "n" when the next
screen in loaded.
The CLEAR parameter says to clear the CALL return stack when the jump is made.
The optional parameters allow you to pass up to 9 values into the next screen.
These values are stored in %1% to %9%. These keys remain set until the next
CALL, GOTO, or SCREEN statement is encountered which also passes parameters.
Note that a SCREEN statement on its own (outside a KEY statement) will result in
the current screen being closed and must be followed by a new page declaration
or else the end of the file.
The parms can include control codes, environmental variables, user-defined
variables, or functions.
See also the CALL and GOTO commands.
DEMOSYS.REF Last revised 03/13/93 Page 44
*******************
SELECT
Is used only with (MOUSER), (MOUSEL), or (MOUSEB) KEY assignments and the SET
MOUSE ON command. Tells the system which mouse button(s) activate a given
choice.
When SELECT is encountered, the system looks for the last ^K assignment on
the same line as the mouse cursor to the left of the mouse cursor. The mouse
press is ignored if a valid input field is not found.
*******************
WRITE filename string
Writes a line of text to a file. This is very useful for creating batch files
from your program. It's also a good way of writing usage information or
anything else you want. The file is appended to (your text is written to the
end of it). If you want the file emptied before you write to it, use a DELETE
command.
"Filename" can by any file (including drive and path information if desired) or
be any of the following DOS devices:
KYBD:
SCRN:
COM1: to COM4:
LPT1: to LPT2:
CONS:
The "string" can be just about anything and can include quotes or spaces. If
you've just prompted the user for five variables (three alpha and two numeric)
and you want them written out in an ASCII-delimited format, you'd say the
following:
WRITE TEST.PRN "^UAlpha1^","^UAlpha2^","^UAlpha3^",^UNum1^,^UNum2^
The filename and the string can include environmental variables, user-defined
variables, or functions if desired.
DEMOSYS.REF Last revised 03/13/93 Page 45
*******************
@ ^Uvar^ "pattern" [ LEN=n ] [ RANGE=n-n ] [ DEF=s ]
[ TEST=cond [rel cond] ] [ QUIT=key ] [ VQUIT=key ] [ HELP=key ]
[ COLOR=n ] [ REQ ] [ NOESCAPE ] [ QUIET | -QUIET ]
Is used for data entry forms. If there are any of these statements in a command
page, then there must be as many of these are there are keyboard input fields on
the screen page. For example,
- *004A Data-entry form
; Note that the first character of each field is automatically converted
; to uppercase for them. As it is, the %Proper% function fixes up most
; fields before writing out the record.
@ ^UName^ "!25X" LEN=5
@ ^UCompany^ "!25X"
@ ^UStreet1^ "!25X" LEN=5
@ ^UStreet2^ "!25X"
@ ^UCity^ "!19X"
@ ^UState^ "!!" LEN=2
@ ^UZip^ "NNNNN-NNNN" /* Because of pattern, ZIP will be minimum of 6 ch
/* Could have imposed a TEST clause if you wanted.
@ ^UPhone^ "(NNN) NNN-NNNN" LEN=14
@ ^USubmit^ "!" VQUIT=S QUIT=Q DEF=E TEST=%Instr%(SQE,^USubmit^) > 0
IF %Upper%(^USubmit^) = Q THEN HOP Skip
ASSIGN ^UName^ = %Proper%(^UName^)
ASSIGN ^UCompany^ = %Proper%(^UCompany^)
ASSIGN ^UStreet1^ = %Proper%(^UStreet1^)
ASSIGN ^UStreet2^ = %Proper%(^UStreet2^)
ASSIGN ^UCity^ = %Proper%(^UCity^)
; Trailing blanks are always removed from responses in data-
; entry forms so you can do something like "^UCity^, ^UState^ ^UZip^"
; and it will show up correctly as "Silver Spring, MD 20910".
WRITE TEST.PRN "^UName^","^UCompany^","^UStreet1^","^UStreet2^",
(continuation) "^UCity^, ^UState^ ^UZip^","^UPhone^"
ECHO
ECHO Entries saved.
DROP Skip
/.
Address entry form
User name: ^K
Company: ^K
Street: ^K
^K
City, State ZIP: ^K , ^K ^K
Phone: ^K
Submit?: ^K (S=submit & save, Q=quit & nosave,
E=edit)
./
POP
DEMOSYS.REF Last revised 03/13/93 Page 46
Incorporating @ commands in your page prevents all normal key assignments from
working; all standard KEY statements are ignored.
Use the (TAB) and (S-TAB) keys to move forward and backward in the fields on the
screen.
There must be at least one QUIT=key or VQUIT=key parameter coded in a data-entry
form page. Otherwise, the cursor cycles through all of the keyboard fields and
the user can only leave if the press (C-C) (quit to DOS) or (C-J) (jump to DOS);
neither of which will process any of their prior inputs.
The default value is -QUIET (vs QUIET) in a data-entry form.
See also the PROMPT and PROMPTA commands.
DEMOSYS.REF Last revised 03/13/93 Page 47
--------------------------------------------------------------------------------
KEY statement
KEY key[,key]... action_command [ parms ]
where:
"key" can consist of any of the following:
regular keys (BS) (LPAREN) (NONE) <-- form only
(special keys) (DEL) (PGDN)
(MOUSER) (DOWN) (PGUP)
(MOUSEL) (END) (RIGHT)
(MOUSEB) (ENTER) (RPAREN)
(ELSE) (EQUAL) (SPACE)
(ANY) (ESC) (TAB)
(A-key) (HOME) (UP)
(C-key) (INS) @key
(S-key) (LEFT) (ALT-n)
(LASTKEY) <-- in BUFFER only
If multiple keys are coded in one KEY statement, the keys must be separated by
only a comma, no spaces.
"action_command" are any of the action commands listed previously.
"parms" are in fact required for some action commands.
Four key assignments are made by default by The DEMO System. If you do not want
these keys assigned as such, you have to specifically reassign the keys or use
the (ANY) key assignment. You cannot use SET KEYS CLEAR or an non-specific
(GLOBAL) definition to clear them.
SET (C-C) QUIT
SET (C-F1) ECHO ^P25,65%PageName%@
SET (C-J) RUN
SET (C-R) REDRAW
DEMOSYS.REF Last revised 03/13/93 Page 48
--------------------------------------------------------------------------------
Miscellaneous string concepts
Screens, displayed text (with a few exceptions), and some action commands can
have some special things imbedded in them. Most of them accept one or more of
the following types of strings:
* &Pn variables passed in when invoking DEMOMAKE itself
* ^Uvar^ user-defined variables
* ^Evar^ DOS-defined environmental variables
* %func% system-defined functions
* ^ctl system-defined control functions (for cursor positioning, coloring,
etc)
Typically, these can be joined together by just putting them next to each other
in the parameter line. For example, FIELD^UCurField^.
The &Pn parameters can include anything. You could pass in "DO MACRO1" and have
a control file that specifies "&P1 &P2" on a line together and that Macro would
be invoked. &Pn parameters are discussed below but are ignored in all other
discussions. Basic rule: anywhere you can use anything, you can put in a &Pn
parameter.
The following table defines which action commands support which of these items.
It indicates the same for the input screen itself.
Action command ^Uvar^ ^Evar^ %func% ^ctl
ASSIGN (left side) OK n/a n/a n/a
(right side) OK OK OK n/a
CALL (parms) OK OK OK OK
CD (directory) OK OK OK n/a
CDD (d:directory) OK OK OK n/a
COPY OK OK OK n/a
DELETE OK OK OK n/a
ECHO, ECHOA OK OK OK OK
GOTO (parms) OK OK OK OK
IF (conditions) OK OK OK n/a
LOCATE OK OK OK n/a
MD (directory) OK OK OK n/a
MSGBOX, MSGBOXA (msg) OK OK OK n/a
PLAY OK OK OK n/a
PROMPT, PROMPTA (var) OK n/a n/a n/a
(DEF= parm) OK OK OK n/a
QUIT OK OK OK n/a
RD (directory) OK OK OK n/a
RUN, RUNA OK OK OK n/a
SAVE OK OK OK n/a
WRITE OK OK OK n/a
Text screens OK OK OK OK
DEMOSYS.REF Last revised 03/13/93 Page 49
&Pn: Variables passed in when invoking DEMOMAKE itself:
When your control file is compiled by the DEMOMAKE program, you can include
up to nine additional parameters. These nine parameters are filled into your
control file whenever &P1 to &P9 is encountered in the control file. For
example:
/* Filename is DEMOPN.CTL
/* Demo of &Pn stuff
- *Dummy Simple screen to show how they work
ECHO &P1 &P2
/.
I hope you passed in some text:
./
QUIT
You would then invoke the DEMOMAKE program by including (in our case) up to two
optional parameters:
DEMOMAKE DEMOPN.CTL DEMOPN.EXE Wayne Software
During compilation, &P1 will be substituted with "Wayne" and &P2 will be
substituted with "Software". (Note that the output file specification, which is
normally optional, is required if you pass in additional parameters.)
If you want multiple words to be passed in and assigned to one variable, enclose
the words in quotes. In the example above "Wayne Software" in quotes would have
filled up just &P1.
DEMOSYS.REF Last revised 03/13/93 Page 50
While the above example shouldn't knock your socks off, remember that the
DEMOMAKE program substitutes the values of the parameters and then compiles the
program. This means that you could change commands each time you compile the
code. For example:
/* Another demonstration. Pass in either MACRO1 or MACRO2
/* when you use the DEMOMAKE command. That will determine which
/* definitions are applied. If you compile with MACRO1, they
/* can't reformat the disk. If you pass in MACRO2, they can.
MACRO MACRO1
- @REFORMAT
CLS
BEEP
ECHO You have not been authorized to use this function.
ECHO Please check with your system administrator.
PAUSE
POP
MEND
MACRO MACRO2
- @REFORMAT
CLS
ECHO ^C2Okay, let's reformat that sucker!
RUN FORMAT A:
ECHO Press a key to continue
PAUSE
POP
MEND
DO &P1
- *Testing Another example of a macro
SET MOUSE ON
KEY (MOUSER) SELECT
KEY (UP) FIELD -1
KEY (DOWN) FIELD +1
KEY @1,R CALL @REFORMAT
KEY @2,X QUIT
SET CURSOR ^C2==>
/.
Select an option:
^K R Reformat disk (restricted access)
^K X Quit
./
DEMOSYS.REF Last revised 03/13/93 Page 51
&n: Variables passed in with a DO statement:
When invoking a macro (using a DO statement), you can pass in up to ten
parameters. These parameters are split up as &1 to &9 and expanded wherever
they occur. An example of this is provided in the DEMOSYS.DOC manual.
^Uvar^: User-defined variables:
You can establish your own variables within The DEMO System. These variables
can be displayed, used in calculations, or reassigned as necessary. The
variables must begin with a "^U", followed by any characters except for spaces
and the "^" character, and end with a "^". Internally, variables are truncated
at 8 characters (ignoring the opening "^U" and closing "^" characters). The
case of the variable is ignored by the system: "^UName^" and "^UNAME^" are the
same.
^Evar^: DOS-defined environmental variables:
You can read (but not set) the value of any DOS environmental variable. These
are any variables that show up when you issue the "SET" command in DOS itself.
Most DOS-environmental variables are optional; if the variable isn't set, ^Evar^
will return null. Typical environmental variables:
^ECOMSPEC^ The user's COMSPEC setting; where COMMAND.COM is
loaded from
^EPATH^ The user's SET PATH setting; where the system looks
for EXE, COM, and BAT files
^EPROMPT^ The user's prompt. Typically, $P$G but some creative
ones exist out there
If you're designing a menuing system, you may require the user to establish some
environmental variable in DOS (e.g. SET MENU=X) that you can test. Frequently,
networks require environmental variables to be assigned to the user's local
network directory. You can test for this too.
The case of the ^Evar^ parameter is irrelevant; all DOS environmental variables
are expressed in uppercase letters and The DEMO System translates yours
appropriately.
DEMOSYS.REF Last revised 03/13/93 Page 52
%func%: System-defined functions:
The DEMO System provides a number of functions which you can test or display in
your program. The functions do not actually change any strings; they themselves
return a string (or numeric) value which you can use in an ASSIGN statement if
you want the value retained.
Some of the functions require one or more parameters, which are typically
enclosed in parentheses and separated by commas. All parameters can be strings,
environmental variables, or user-defined variables. Strings should not be
enclosed in quotes. (It's %Drive%(c), not %Drive%("C").) You cannot use a
function as a parameter for a function; you have to use a separate ASSIGN
statement for to resolve a function and then use the resulting variable as your
parameter.
If your parameter includes a comma or a close-parenthesis, you would have to
specify a different delimiter for the parameter. You can use any of nine other
delimiters by using one of them instead of the open-parenthesis. The choice of
characters is any one of the following:
/ (slash)
[ (open bracket)
| (vertical bar)
^ (control character)
: (colon)
! (exclamation point)
* (asterisk)
_ (underscore)
- (dash)
This delimiter will have to be used between parameters and at the end of the
last parameter. For example, the following are both functionally equivalent:
%Mid%(^UName^,4,5)
%Mid%!^UName^!4!5!
The functions are listed alphabetically below. Typical parameter types are
indicated but, as was mentioned, the parameters can actually be strings,
environmental variables, or user-defined variables.
The descriptions indicate "Returns: xxx" which shows you whether the function
returns a string ("s"), number ("n"), or single character ("c").
Also indicated is "Invalid: xxx" which indicates what sort of value is returned
if invalid parameters are specified, typically "0" or "-1" (for numeric
functions), "null" (for string or character functions), or "n/a" (meaning the
function doesn't accept parameters).
DEMOSYS.REF Last revised 03/13/93 Page 53
%Add%(var,num) Returns: n Invalid: 0
Adds a number to another number. If the first parameter is undefined, it is
assumed to have a value of 0. Remember, this doesn't change the value of
var at all. You have to do that doing something like this:
ASSIGN ^UVar^ = %Add%(^UVal^,1)
%Col% Returns: n Invalid: n/a
Indicates the current column position on the screen.
%Date% Returns: s Invalid: n/a
Returns the current system date in mm/dd/yy format.
%DateOrig% Returns: s Invalid: n/a
Returns the date the user initially loaded your program in mm/dd/yy format.
Typically the same as %Date%.
%DateR2S%(num) Returns: s Invalid: null
Translates a relative date into its mm/dd/yy value. See %DateS2R%.
%DateS2R%(date) Returns: n Invalid: 0
Translates a date (in mm/dd/yy or mm-dd-yyyy format) into its relative date.
All relative dates are based on January 1, 1899 for some reason but the year
can't be before 1900 so the smallest value you can get is 365 which is for
%DateS2R%(01-01-1900).
%DateValid%(date) Returns: n Invalid: 0
Returns 1 if the date is valid, 0 otherwise. You could use %DateS2R% to
accomplish the same thing.
%Dir% Returns: s Invalid: n/a
Returns the current directory in drive:directory format. The function does
not put a slash at the end of string unless the directory is the root, in
which case it comes back as drive:\. See the %FileJoin% function.
%Display% Returns: s Invalid: n/a
Returns COLOR (primary color set) or MONO (alternate color set). This doesn't
have any relationship to whether the user's monitor is color or monochrome;
only which color set you're using.
%DisplayEGA% Returns: n Invalid: n/a
Returns 1 if the user's monitor supports EGA, otherwise 0.
%DisplayNum% Returns: n Invalid: n/a
Returns 1 (primary color set) or 0 (alternate color set). This doesn't have
any relationship to whether the user's monitor is color or monochrome; only
which color set you're using.
%DisplayVGA% Returns: n Invalid: n/a
Returns 1 if the user's monitor supports VGA, otherwise 0.
DEMOSYS.REF Last revised 03/13/93 Page 54
%Div%(var,num) Returns: n Invalid: 0
Divides one number by another. If the first parameter is undefined, it is
assumed to have a value of 0. If the second parameter is undefined or 0, the
result is 0. Remember, this doesn't change the value of var at all. You have
to do that doing something like this:
ASSIGN ^UVar^ = %Div%(^UVal^,2)
%Drive%(drive) Returns: n Invalid: 0
Returns 1 if the drive indicated by the parameter is valid, 0 if not. The
drive parameter is truncated to one character if a longer one is provided.
%DriveCur% Returns: s Invalid: n/a
Returns the current drive letter followed by a colon.
%DriveDir%(drive) Returns: s Invalid: null
Returns the default subdirectory on the specified drive. The subdirectory is
preceded by the drive and a colon; it is not followed by a slash (e.g. it
returns "C:\UTIL"). If the default directory is the root, the result will
come back with a trailing slash (e.g. "C:\"). See the %FileJoin% function.
The drive parameter is truncated to one character if a longer one is provided.
%DriveDirOrig% Returns: s Invalid: n/a
Returns the default drive and directory that was in affect when your program
was loaded. Often useful to return you to the original subdirectory. See
also the %FileOrigDir% and %FileOrig% functions.
%DriveLabel%(drive) Returns: s Invalid: null
Returns the label on a given drive. The label can be a maximum of 11
characters in length. The drive parameter is truncated to one character if a
longer one is provided.
%DriveOrig% Returns: s Invalid: n/a
Returns the default drive (followed by a colon) that was in affect when your
program was loaded. See also the %FileOrigDir% and %FileOrig% functions.
%DriveSpace%(drive) Returns: n Invalid: -1
Returns the amount of free space available on the specified drive. The drive
parameter is truncated to one character if a longer one is provided.
%FieldMax% Returns: n Invalid: n/a
Returns the maximum number of user input fields on the current screen.
%FieldNum% Returns: n Invalid: 0
Returns the current field number on the current screen.
DEMOSYS.REF Last revised 03/13/93 Page 55
%FileDate%(filespec) Returns: s Invalid: null
Returns the file creation date of the specified file in mm/dd/yy format.
%FileExist%(filespec) Returns: n Invalid: 0
Returns 1 if the specified file exists, 0 otherwise.
%FileJoin%(path,file) Returns: s Invalid: null
Returns a string with the path joined with the file name. In so doing, the
function adds a trailing slash to the path if necessary. It then checks the
combined filespec and returns a value of null if any of the following
conditions are met: the filespec is invalid, the specified drive does not
exist, or the specified subdirectory on the drive does not exist. See also
the %FileValid% function. Note that DOS accepts a whole bunch of filespecs as
"valid" and then alters them later; "ABCDEFGHIJKLM" will actually become
"ABCDEFGH.IJK". This function returns the name before DOS alters it.
%FileMakeTest%(path) Returns: n Invalid: non-0
A general-purpose function that tells you a number of things about a drive or
directory. The function tries to create a temporary file in the specified
path, deleting it afterward if successful. If successful, it returns a 0
file. If nut successful, it returns one of the following DOS error codes:
3 path not found (or specified incorrectly)
15 invalid disk specified
19 disk is write protected
21 disk not ready (e.g. no disk in drive A)
26 disk is not in DOS format
32 sharing violation (didn't have write access to the directory)
%FileOrig% Returns: s Invalid: n/a
Returns the name of the program that the person loaded including drive and
path information.
%FileOrigDir% Returns: s Invalid: n/a
Returns just the drive and path of the program that the person loaded. Useful
in cases where there are data files or something in the same location. The
path does not end with a "\" unless it's the root. See the %FileJoin%
function.
%FileSize%(filespec) Returns: n Invalid: -1
Returns the size of the specified file in bytes.
%FileTime%(filespec) Returns: s Invalid: null
Returns the file creation time of the specified file in hh:mm:ss format.
%FileValid%(filespec) Returns: s Invalid: null
Returns a fully formatted filespec (including drive and path information if
not provided). Returns null under any of the following conditions: the
filespec is invalid, the specified drive does not exist, or the specified
subdirectory on the drive does not exist. Note that DOS accepts a whole bunch
of filespecs as "valid" and then alters them later; "ABCDEFGHIJK" will
actually become "ABCDEFGH.IJK". This function returns the name before DOS
alters it.
DEMOSYS.REF Last revised 03/13/93 Page 56
%FreeEMS% Returns: n Invalid: 0
Returns the amount of free EMS memory in kilobytes.
%Instr%(str1,str2) Returns: n Invalid: n/a
Returns the column position in string1 in which string2 is found. For
example, %Instr%(Bruce,uc) returns a value of 3. Note that the search is case
sensitive.
%Instr2%(n,str1,str2) Returns: n Invalid: 0
Returns the column position in string1 in which string2 is found, starting
the search in column position n. The search is case sensitive. If n is 1,
then you can use the %Instr% function instead.
%Left%(string,num) Returns: s Invalid: null
Returns the leftmost num characters from string.
%Len%(string) Returns: n Invalid: n/a
Returns the length of the specified string.
%Lower%(string) Returns: n Invalid: n/a
Returns the specified string expressed in lowercase letters.
%Mid%(str,offset,num) Returns: s Invalid: null
Returns a subset of a given string, starting at position offset and taking
num characters from that point. If the num parameter is left as blank, the
function will return all characters starting at offset and going until the
end of the string. Note that three parameters are required so you have to
code this like: %Mid%(Bruce,3,)
%Mouse% Returns: n Invalid: 0
Returns the number of buttons the user's mouse has. Typically 2 or 3 if a
mouse is present, 0 if not.
%Mult%(var,num) Returns: n Invalid: 0
Multiplies one number by another. If the first parameter is undefined, it is
assumed to have a value of 0. Remember, this doesn't change the value of
var at all. You have to do that doing something like this:
ASSIGN ^UVar^ = %Mult%(^UVal^,3)
DEMOSYS.REF Last revised 03/13/93 Page 57
%PageDesc% Returns: s Invalid: n/a
Returns the description for the current filename reference.
%PageLines% Returns: n Invalid: 0
Returns the number of lines on the current display screen.
%PageMax% Returns: n Invalid: n/a
Returns the maximum defined screen in the current program.
%PageName% Returns: s Invalid: n/a
Returns the current file page name. This may be "@label", "*ref", or
"filename" depending on what type of page it was.
%PageNum% Returns: n Invalid: n/a
Returns the current page number.
%PathCanMake%(path) Returns: n Invalid: 0
Returns 1 if the specified path can be created. A 0 will be returned if the
path is invalid, the specified path exists already, or if the necessary
subdirectories don't exist to build it upon; e.g. creating \TC\NEW when \TC
doesn't exist. The DEMO System actually determines the validity of this by
trying to create the path, and then removing the path once done. See also the
%FileCreateTest% function.
%PathExist%(path) Returns: n Invalid: 0
Returns 1 if the specified path exists already.
%PrinterReady%(num) Returns: n Invalid: 0
Returns 0 if the specified printer is not ready. The printer must be
specified by its number: 1 is LPT1, 2 is LPT2, 3 is LPT3. COM printers
cannot be tested.
%Proper%(str) Returns: s Invalid: n/a
Returns a string in proper name case format. The first letter of every word
is capitalized and the other characters are not. So "WAYNE software" comes
out as "Wayne Software".
%ReplaceStr%(str,old,new) Returns: s Invalid: n/a
Returns a string with any occurence of the old string converted to the
new string. For example, "%ReplaceStr%(Bruce,uce,at)" would return "Brat".
The old and new strings can be of any length.
%Right%(str,num) Returns: n Invalid: null
Returns the right-most num characters from the specified string.
%Row% Returns: n Invalid: n/a
Returns the current row.
DEMOSYS.REF Last revised 03/13/93 Page 58
%Sub%(var,num) Returns: n Invalid: 0
Subtracts one number from another. If the first parameter is undefined, it is
assumed to have a value of 0. Remember, this doesn't change the value of
var at all. You have to do that doing something like this:
ASSIGN ^UVar^ = %Sub%(^UVal^,1)
%Time% Returns: s Invalid: n/a
Returns the current system time in hh:mm:ss format.
%TimeElapsed% Returns: s Invalid: 0
Returns the elapsed time between when the program started (%TimeOrig%) and
the current time (%Time%) in hh:mm:ss format. Result will be 0 if the time
extends over midnight.
%TimeOrig% Returns: s Invalid: n/a
Returns the time at which the program was initially started in hh:mm:ss
format.
%TimeR2S%(num) Returns: s Invalid: null
Returns a relative time converted to hh:mm:ss format.
%TimeS2R%(string) Returns: n Invalid: 0
Converts a time string (in hh:mm:ss format) converted to the number of seconds
after midnight.
%Trim%(string) Returns: s Invalid: n/a
Trims leading and trailing spaces from a specified string.
%Upper%(string) Returns: s Invalid: n/a
Returns a string with all lowercase letters converted to uppercase.
%Weekday%(date) Returns: s Invalid: null
Returns the weekday (in proper case format--"Sunday") for a given date in
mm/dd/yy or mm-dd-yyyy format.
%1% to %9% Returns: s Invalid: n/a
These are the parameters passed in by a CALL, GOTO, or SCREEN command.
DEMOSYS.REF Last revised 03/13/93 Page 59
^ctrl: Control codes:
The screens themselves can include codes which establish colors, input
locations, and other things. There are seven types of control codes that The
DEMO System accepts in text strings (including logos and cursor indicators) but
one of them (the "^Prow,col" indicator) should not be used within a screen.
These codes are as follows:
^Cn /* Set the color to color (or monochrome) set "n"
^K /* Establish this as a keyboard-input field
^Evar^ /* Print a DOS-defined environmental variable here
^Uvar^ /* Print a user-defined variable here
%func% /* Print a function result here
^Tn /* Print "n" non-destructive spaces here
^Sn /* Print "n" destructive spaces here (used only
/* to reduce the size of your input file; The DEMO
/* System automatically uses space compression when it
/* encounters five or more spaces together)
^Pr,c /* Locate the cursor at row "r" and column "c":
/* this setting is not allowed within text screens
/* themselves and should only be used in SET CURSOR,
/* SET LOGO, ECHO, PROMPT, etc commands
^_ /* Ignored. Typically used only if you want to
/* print out one of the other control key sequences
Any text that is not part of these control codes (including spaces) are treated
as text and is printed as is.
DEMOSYS.REF Last revised 03/13/93 Page 60
--------------------------------------------------------------------------------
Primary vs alternate screen
There are actually two screens that The DEMO System uses. The first screen, the
"primary screen", is used automatically for all text screens and by most of the
commands. The second screen, called the "alternate screen", is typically used
when you want to run a DOS command and not have the output from this command
affect the text screen the user is viewing. Sometimes, you will want the output
of the command to disappear completely.
There are are number of commands that provide the capability of writing to
either of these two screens:
Primary Alternate
CLS vs CLSA
ECHO vs ECHOA
MSGBOX vs MSGBOXA
PAUSE vs PAUSEA
PROMPT vs PROMPTA
RUN vs RUNA
In most cases, stick to the command without the "A" suffix.
--------------------------------------------------------------------------------
System maximums
Several (but not all) of these maximums can be expanded if necessary. If this
becomes a problem, contact Wayne Software at the address specified at the top of
this document.
Maximum number of pages: 1000
Maximum number of pages with imbedded text: 999
Keys (or actions) defined per screen: 255
Keyboard input fields per screen: 90
Color sets: 8 (0 to 7)
CALL return stack: last 20 calls
Maximum number of user variables used in program: 30
Maximum number of lines per screen: 25
Maximum supported number of columns per screen: 80
Maximum screen size (in bytes): 2K