home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
system
/
askenv
/
askenv.doc
< prev
next >
Wrap
Text File
|
1995-02-27
|
11KB
|
399 lines
AskEnv 2.5 23-Mar-93
==========
What is AskEnv for?
-------------------
The only way for a shell script for input is the rather limited ASK
command. Since Commodore released the new OS2 ARexx is a part of the
operating system. This programming language is missing a powerfull
user interface too! It is a language ported from IBM mainframes
using page based alpha terminals.
AskEnv imports the capabilities for user friendly in whatever
programming language you want to use. ARexx-programs, shell-scripts,
Superbase DML-programs and all other languages which can start an
external program and read a file can now use system-, file- and
user defined requesters.
AskEnv requires at least OS 2.04.
Usage:
------
Running AskEnv from WorkBench is useless. The CLI syntax is (or ARexx,
Superbase...):
AskEnv [EOL/S,F=FREQ/S,DEF/K,SBMODE/S,S=SREQ/K,BODY/K,NEG/K,POS/K,GADFILE/K]
AskEnv is pure and can be made resident.
Functions
=========
There are two classes of functions: first, simple commands in a single
command line. Second, we have only one complex function: with the help
of a configuration file, it can construct free definable requesters.
Simple Functions
----------------
Read Line
---------
AskEnv [>file] [EOL]
Reads a line from keyboard until it recieves an End of Line and then
writes everything into standard output. The option EOL adds a End of
Line on the output.
File Requester
--------------
AskEnv [>file] FREQ title [DEF path] [DIR] [SBMODE] [EOL]
calls a file requester, the ASL or whatever you patched to use instead.
With DEF you can set the initial path to the directory or file you want
to show in the file req. DIR limits the requester to show only directories.
WARNING: If started from SBPro, you must use the SBMODE option. Otherwise
the requester will hang dead, and so will SBPro. This is a bug in SBPro:
It doesn't like a view on its window to determine the screen it is
running on.
System Requester
----------------
AskEnv SREQ line1 [BODY line2] POS posiButton [NEG negaButton]
If the user selected the negative text, a WARN returns.
Complex Requester Functions
---------------------------
With "AskEnv gadfile <file>" the program reads a config file, an unstrucured
ASCII file with keywords. The elements can be distributed over lines at
will.
Strings must reside on one single line and be enclose by " ", if they
contain spaces.
A ";" makes the rest of the line a comment. Keywords must be written in
capitals.
IMMEDIATE vs SELECT-Mode
------------------------
Depending on the definition of the gadgets, AskEnv selects a mode to act:
IMMEDIATE Requester disappears after the first input;
the ID of the selected gadget is written into the
file VAR mentioned in the header. If no name is
given, the variable "AskEnv_Button" is used.
The ID of the button is the number in order of
definition, starting with 1.
SELECT resides until a END, CANCEL or the close gadget has
been selected. Then writes the conditions of all
gadgets.
The close gadget always returns a WARN, nothing will be written.
Values of result variables are therefore undefined! Usually, they
have the same value as before, but these could have been changed.
The mode will be selected automatically:
Button only will be treated as IMMEDIATE. Adding a not-button
switches to SELECT. Not-buttons are also the filereq and the
program start buttons.
Elements with read only have no effect.
Configuration File
------------------
The file has a header and n gadget definitions. The header contains the
global attributes:
WINDOW : this must be the first keyword
SIZE x y w h : separated by spaces; I'm not responsible for usefull
coordinates.
As an alternative use:
CENTER w h : centers the requester on the screen.
NAME name : window title, optional
SCREEN name : set name to the name of a public screen, and AskEnv will
open the new requester on this screen. If this public
screen doesn't exists, it will fall back to the default
public screen, usually the workbench screen.
VAR name : In IMMEDIATE mode, ie. if only buttons are present,
this variable contains the number of the selected button.
In SELECT mode, it contains the number of the selected
button, but only if the button has the keyword GLOBAL!
GLOBAL can be used without a variable name, but then it
must not be placed in front of the delimiting "#".
Without a VAR definition, the variable "AskEnv_Button" will
be used.
Important: starting with version 2.4, VAR no longer defines a file to
contain all variables. This was a relict from early days, and no one used it
later. If needed, I can implement it again.
After the header the gadget definitions:
A gadget starts with a keyword and ends with a " #" (as in MountList).
Currently these gadget types are supported:
BUTTON various functions
CHECKBOX
INTEGER
NUMBER read only
CYCLE
STRING
MX
TEXT read only
HIBOX raised box
LOBOX recessed box
Button and string gadgets can be combined to serve as file request call.
A button can also call a program.
Functions for all Gadgets:
--------------------------
POSITION x y w h: must be used with every gadget. Minimal height depends
on screen font height.
LABEL text : gadget text, by default IN the gadget box, can be set with
PLACETEXT loc : ABOVE, BELOW, LEFT or RIGHT
END : selection terminates the requester. Can be used more than
once.
CANCEL : Nothing will be written.
GLOBAL var
LOCAL var : the value will be written in this either local or global
(ENV:) variable. What exactly will be written depends on
the gadget type.
ENTRY : must be the last keyword of a gadget, if used. Followed by
1 to n entries, depending on gadget type.
Type Specifics:
---------------
BUTTON
------
In IMMEDIATE mode, returns the number of the button into the global variable
defined in the header. Count only buttons and in order of definition!
In SELECT mode, its number is written into the variable "AskEnv_Button". Use
the keyword GLOBAL followed by a dummy variable name.
Specific Functions for BUTTONs:
FREQ : The next gadget must be a string gadget definition, which
may contain a default path as ENTRY. Pressing the
button activates a file requester. The selection appears
in the string requester.
DIR : Additional option for the file requester: limits the
requester to show only directories. May not work with every
ASL file requester replacement (i.e MFR).
SYNCRUN : Modal execution of external programs. The string after the
keyword will be executed as program. AskEnv interrupts all
input until the program terminates. If the command contains
options or arguments separated by spaces, enclose it in
quotation marks.
If a non 0 error code returns, you can use this value:
WARN limit : the number limit sets the maximum return code which will
not generate a warning. AskEnv will continue to process
the current requester. If the return code is greater than
limit, a requester opens containing a option to end
AskEnv. It then returns a code of 10.
ASYNCRUN : The same as SYNCRUN, but non modal. The new process is
independant and AskEnv ready for further input.
FILE filedef : an optional output file for the asynchron started program.
i.e. NIL:, RAM:test or a CON: window.
Before a external program (either synchron or asynchron) is actually
started, the values of all gadgets are written in their variables. The
external program may use these values for further processing.
These values can be used immediately by AskEnv: SYNCRUN and ASYNCRUN
commands may contains variables. The definition
STRING ...
LOCAL myDir ...
BUTTON ...
SYNCRUN "dir $myDir"
tries to read the contents of the string gadget as a directory.
CHECKBOX
--------
CHECKED : start in selected state
A CHECKBOX returns 0 if selected, -1 otherwise.
INTEGER
-------
After ENTRY you can set a default number to appear after startup. With
"MAXCHARS number" you set the upper limit of characters the gadget
may contain (default 20).
NUMBER
------
Like INTEGER, but read only. Nothing will be written. With NOBOX you
can suppress the border.
STRING
------
Similar to INTEGER, with the same option MAXCHARS (default 80).
TEXT
----
Like NUMBER.
CYCLE
-----
List the desired entries after the keyword ENTRY. The number of the
selected entry will be written starting with 0.
Remember: ENTRY must always be the last keyword!!
MX
--
This gadget type will be handles like the CYCLE gadget above. There is
another option:
SPACING n : additional spacing between the knobs
HIBOX, LOBOX
------------
BE AWARE: no end sign #, only 4 parameters x, y, width, height:
HIBOX
50 20 100 20
And now the Rest:
-----------------
The distribution pack must contain:
LACE (dir)
About.req intro.req
Offset.req Select.req
Strings.req warning.req
HIRES (dir)
about.req intro.req
Offset.req Select.req
Strings.req Warning.req
AskEnv
AskEnv.doc
AskEnv.dok
Brief.rexx
BriefHilfe.req
Changes.doc
Changes.dok
dearc.req
DeArc.rexx
LiesMich
Plotter Plotter.info
PrefMan.rexx
ReadMe
Test
To Do:
------
- AREXX support
Thanks to all the people which helped with tips and tricks.
Starting with V2.4, AskEnv has been tested with MungWall and Enforcer.
This wasn't a real obstacle because AskEnv was written with M2Amiga
Modula2.
It has been tested under OS 2.04 and OS 2.1.
This program may be freely distributed, but the above mentioned files must be
be included in the distribution.
It may not be sold on public domain disks which cost more than 5 sFr/DM. If
a disk is sold for more than this price, please contact me.
If you intend to publish AskEnv on collection which will be distributed with
printed manuals, you must contact me first.
All rights reserved.
Send bugreports to:
===========================================================================
Bengt Giger
Schmiedgasse 48
CH-8640 Rapperswil
Switzerland
055/27 98 79
Link-CH1 ++41 (0)61 681 63 60 Aminet: B.GIGER%LINK-CH1 44:8010/408.0
Z-Netz: B.GIGER@LINK-CH1
===========================================================================