Please enable JavaScript to view this site.

xcall MIAMEX, MX_GETCMDINP, cmdinfld {,cmdinput}

xcall MIAMEX, MX_SETCMDINP, cmdinfld {,cmdinput}

MX_GETCMDINP (MIAMEX 52) allows you to determine if command file input is enabled or disabled for the two main modes of keyboard input.

MX_SETCMDINP (MIAMEX 53) allows you to enable or disable command file input for the two main modes of keyboard input.

Parameters

cmdinfld  (Num)  [out for GET, in for SET]]

For GET: returns 1 if command file input for INFLD is enabled, else 0. For SET: set to 1 to enable commmand file input for INFLD

cmdinput  (Num)  [out for GET, in for SET]]

For GET: returns 1 if command file input for INPUT and INPUT LINE enabled, else 0. For SET: set to 1 (default) to enable command input for INPUT and INPUT LINE enabled, else 0 to disable.

Comments

The first mode, sometimes referred to as "low-level", "raw", "unbuffered" or "character-oriented", is used by some XCALL subroutines (primarily INFLD and SBXINP) which process characters individually as they are typed. By default, characters in the current command file are ignored in character-oriented mode but can be enabled via this function. Note that INFLD and SBXINP can also enable command file via their own parameter options, but they cannot disable it if previously enabled globally.

The second mode, sometimes referred to as "buffered" or "line-oriented", is used by the INPUT and INPUT LINE statements (as well as the command prompt). By default, command file input is enabled for line-oriented mode but can be disabled by this function.

The main reasons why you might want to disable command file input for line-oriented input mode are:

To prevent the accidental use of command file input for certain critical kinds of inputs (passwords, etc.) which you want to force the user to handle interactively even amid an otherwise scripted process.
To allow command file wrappers to be created for programs which may perform interactive line-oriented input but then return to the command file at the completion of the program.

Note that setting the cmdinput flag to 0 only disables command file input for INPUT and INPUT LINE within programs (i.e. when not at the dot prompt). Command file input is always enabled when at the dot prompt. Furthermore it is automatically re-enabled (set to 1) when you end up at the command prompt and there is no more command file input available.

Example

A program—perhaps a utility menu—may create and then chain to the following command file:

RUN PROGRAM1

RUN PROGRAM2

 

If PROGRAM1 performs an INPUT operation, it will normally grab the next line ("RUN PROGRAM2") from the command file, which clearly isn’t what you want here. To prevent that, MX_SETCMDINP can be used in advance of chaining to this command file to disable command file input. When PROGRAM1 ended, the command prompt executive would see and execute "RUN PROGRAM2," since command file input is always enabled when not currently running a program, and the normal command file input would be re-enabled once the process reached the end of its command file.

History

2023 August, A-Shell 6.5.1738:  Added cmdinput parameter.

Created with Help+Manual 9 and styled with Premium Pack Version 5 © by EC Software