home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
com_term
/
ca28_1.arj
/
INSTALL.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-07-08
|
17KB
|
555 lines
SET TTHRU OFF ; Must be 1st line to suppress typethrough
ON ESCAPE GOSUB Escape ; Exit if ESC
;**** TRACE ON ; Debugging
;
; ----- COM-AND INSTALL script for automatic execution
; Commenced: 10/90 R.McG
; -----------------------------------------------------------------------
; Purpose:
; This script, named INSTALL.CMD, is executed automatically by
; COM-AND after the load-time creation of the DFT file. It may be
; manually invoked through the F2 window at any time, as well.
; -----------------------------------------------------------------------
;
; Initialization
;
LEGEND "Welcome..."
SET RDISP OFF ; Ignore received chars
;
; Establish a DWINDOW, and change the text display to window default.
; .. Save the previous text display attribute, for restoration later.
;
DWIND 1,2 22,78 ; Establish scrolling region
N99 = "_TEXT" ; Save original text attr
SET TEXT "_DEFA" ; Set text attr
;
; Perform tasks
;
Again:
GOSUB Intro ; Paint intro screen
GOSUB Set ; Look at autoexec file
GOSUB Port ; Select port for default use
GOSUB Speed ; Select speed for default use
GOSUB Type ; Select modem type
GOSUB Update ; Ending "do it again?" query
IF FAILED GOTO Again
;
; Save current settings
;
SET TEXT N99 ; Reset text attr for store
STORE DEFAULT ; Update defaults
GOTO Almost ; Skip Escape tests
;
; Escape was hit - if runtime invocation, do the CODA.
;
Escape:
IF STRCMP "_RUNT" "NO" GOTO Exit
;
; Last words
;
Almost:
ON ESCAPE GOSUB EXIT ; New ESC processor
SET TEXT "_DEFA" ; Set text attr
GOSUB Coda ; Ending last words
;
; Exit the script
;
Exit:
SET TEXT N99 ; Reset text attr finally
DWINDOW CLEAR ; Clear any scrolling region
CLEAR ; Clear entire text window
EXIT
;
; ----- Subroutine: Intro -> introductory screen
; .. note: BOX instead of WOPEN is used - allowing global ESC
;
Intro:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " INSTALL intro "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS " ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓▓ ▓▓▓▓▓▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ▓▓ "
MESS " ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓▓▓▓▓ "
MESS " "
;
; Add introductory text
;
IF STRCMP "_RUNT" "YES"
MESS "COM-AND has created a file named COM-AND.DFT for default values. This means"
MESS "that this is the first time COM-AND has executed under these conditions. A"
MESS "script (INSTALL.CMD) included with the COM-AND release will help install the"
MESS "settings you will use in this and subsequent COM-AND sessions."
ELSE
MESS "You have invoked INSTALL.CMD to change COM-AND's default settings. The IN-"
MESS "STALL will allow you to 1) add a COM-AND= environment variable to the auto-"
MESS "exec.bat, 2) set modem port and type, and 3) set operating values for this"
MESS "and subsequent COM-AND sessions."
ENDIF
MESS " "
MESS "In order to use this script, you will need to know a few facts about your PC"
MESS "and its configuration. You will need to know the boot drive, the modem port"
MESS "and the type of modem you will be using. This script will help you decide"
MESS "these matters (as much as it is able) and change the DFT file accordingly."
MESS " "
MESS "You may skip this installation script by pressing ESC now (or anytime during"
MESS "the installation). Press any other key to continue..."
;
; Wait for a keypress
;
KEYGET S0 ; Wait for it
RETURN ; And we're done
;
; ----- Subroutine: Set -> Inform of update autoexec.bat with COM-AND=
;
Set:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " Boot config "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "COM-AND works best if a single subdirectory is used for COM-AND files and"
MESS "scripts. COM-AND is executing currently from the subdirectory: "
MESS " "
MESS "_SUBD"
MESS " "
MESS "COM-AND looks for files and scripts 1) in the subdirectory it finds at run-"
MESS "time, and if not there 2) in the subdirectory pointed out by the environment"
MESS "variable 'COM-AND='. If COM-AND's working subdirectory is indicated by that"
MESS "environment variable, COM-AND may be executed in ANY subdirectory and still"
MESS "find scripts and files."
MESS " "
MESS "You may use this script to update your AUTOEXEC.BAT file to SET the environ-"
MESS "ment variable, or skip this step."
MESS " "
MESS "Select S)kip, U)pdate, or ESCape (escape cancels this script): "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "S" ; S)kip
ENDCASE
CASE "U" ; U)pdate
GOSUB Autoexec ; Do the update
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Set
ENDCASE
ENDSWITCH
RETURN ; And continue
;
; ----- Error: Open a window, display a message, and exit
; S0 passes the error message
;
Error:
WOPEN 10,10,12,70 (contrast)
ATSAY 10,12 (contrast) " Error "
ATSAY 11,12 (contrast) S0(0:55); Max msg width 55 chars
ATSAY 12,26 (contrast) " Press any key to continue "
;
; Wait a keypress
;
KEYGET S0 ; Wait for any key
WCLOSE
RETURN
;
; ----- Subroutine: Autoexec -> update autoexec.bat with COM-AND=
;
Autoexec:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " AUTOEXEC update "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "Please enter the drive letter (A,B,C...) from which your PC is booted. If"
MESS "a diskette is used for boot, please see that the boot disk is in that drive."
MESS " "
MESS "Select drive: A,B,C...: "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
IF NOT ALPHA S0
SOUND 100,100
GOTO Autoexec
ENDIF
;
; Look for an autoexec.bat file on that drive
;
S1 = S0*":\AUTOEXEC.BAT"
IF ISFILE S1 GOTO Auto200
;
; Missing autoexec.bat
;
MESS " "
MESS "No AUTOEXEC.BAT file was found on the indicated drive. One will be created"
MESS "if you wish, or you may try another drive."
MESS " "
MESS "Select C)reate, A)nother-drive, or ESCape (escape cancels this script): "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "C" ; C)reate
GOTO AUTO100
ENDCASE
CASE "A" ; A)nother
GOTO Autoexec ; Do it again
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Autoexec
ENDCASE
ENDSWITCH
;
; Create AUTOEXEC... get parameter for the subdirectory
;
Auto100:
GOSUB GetSetVal
;
; Create it
;
FOPENO S1 TEXT ; Open for output
IF FAILED ; If open failed
S0 = "Error opening "*S1
GOSUB Error
GOTO Autoexec
ENDIF
WRITE "SET COM-AND="*S0*"!"
WRITE "DATE!"
WRITE "TIME!"
WRITE "^Z" ; ASCII EOF
FCLOSEO ; Close it
RETURN ; And we're done creating it
;
; AUTOEXEC exists... append SET COM-AND= to the file
; .. note: I don't test for the presence of SHELL or another COM-AND=
;
Auto200:
GOSUB GetSetVal
;
; Create it
;
FOPENO S1 TEXT APPEND ; Open for output - appending at EOF
IF FAILED ; If open failed
S0 = "Error opening "*S1
GOSUB Error
GOTO Autoexec
ENDIF
WRITE "SET COM-AND="*S0*"!"
WRITE "^Z" ; ASCII EOF
FCLOSEO ; Close it
RETURN ; And we're done creating it
;
; Subroutine: GetSETVal (S0 returns value)
;
GetSetVal:
MESS "COM-AND is executing currently from the subdirectory: "
MESS " "
MESS "_SUBD"
MESS " "
MESS "Please enter the subdirectory you will use for COM-AND. If the current sub-"
MESS "directory is the one, just press return. Otherwise enter the new subdirec-"
MESS "tory as d:\path (d being drive letter, and path being fully qualified path)."
MESS " "
MESS "Enter COM-AND's working subdirectory (or press CR):!"
;
; Read working subdir
;
GET S0 76 ; Read response
IF NULL S0 S0="_SUBD" ; Make default condition
RETURN
;
; ----- Subroutine: Port -> Select the port we'll use
;
Port:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " Port selection "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "COM-AND is defaulted to "*"_PARM"(11:14)*" for serial communications."
MESS " "
MESS "This may or may not be right for your PC. At this point, you may skip"
MESS "changing the setting, select another serial port for the default, and"
MESS "optionally find ports on your machine for possible choices. "
MESS " "
MESS "Select S)kip, F)ind, or numeric port number (1,2,3,4): "
CURSOR N1,N2 ; Save current cursor
MESS " "
MESS "Alt-P may be used at any time in CRT mode to change this default."
CURSOR N3,N4 ; Save cursor here, too
;
; Wait for a keypress
;
Port100:
ATSAY N1,N2 (default) " "
LOCATE N1,N2 ; Relocate cursor
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "S" ; S)kip
ENDCASE
CASE "F" ; Find
LOCATE N3,N4 ; Relocate cursor
GOSUB Survey ; Do the survey
GOTO Port100 ; And ask again
ENDCASE
CASE "1" ; COM1
SET PORT COM1 ; Do the update
ENDCASE
CASE "2" ; COM2
SET PORT COM2 ; Do the update
ENDCASE
CASE "3" ; COM3
SET PORT COM3 ; Do the update
ENDCASE
CASE "4" ; COM4
SET PORT COM4 ; Do the update
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Port
ENDCASE
ENDSWITCH
RETURN ; And continue
;
; ----- Test existing ports...
;
Survey:
COMPARMS S0 ; Get current settings
S0 = S0(11:14) ; Save original value
N0 = 0 ; Make a counter of ports found
MESS " " ; new line
SET PORT COM1
IF "_UART" GE 0
MESS " I believe COM1 is a serial port"
INC N0
ENDIF
SET PORT COM2
IF "_UART" GE 0
MESS " I believe COM2 is a serial port"
INC N0
ENDIF
SET PORT COM3
IF "_UART" GE 0
MESS " I believe COM3 is a serial port"
INC N0
ENDIF
SET PORT COM4
IF "_UART" GE 0
MESS " I believe COM4 is a serial port"
INC N0
ENDIF
SET PORT S0 ; Restore default
IF N0 eq 0 MESS " I can't find serial ports on COM1/2/3 or 4"
RETURN
;
; ----- Subroutine: Speed -> Select the default speed we'll use
;
Speed:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " Speed selection "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "The current serial port "*"_PARM"(11:14)*" is defaulted to "*"_PARM"(0:3)*" baud."
MESS " "
MESS "This may or may not be right the best speed for your modem. Please select"
MESS "the HIGHEST speed your modem is able to use. As before, you may skip this"
MESS "step if you wish."
MESS " "
MESS "Select S)kip, or from below (1 through 5): "
CURSOR N1,N2
MESS " "
MESS " 1) 300 baud"
MESS " 2) 1200 baud"
MESS " 3) 2400 baud"
MESS " 4) 9600 baud"
MESS " 5) 19.2K baud"
MESS " "
MESS "Alt-P may be used at any time in CRT mode to change this default."
;
; Wait for a keypress
;
LOCATE N1,N2 ; Relocate cursor
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "S" ; Skip
ENDCASE
CASE "1"
SET BAUD 300 ; Do the update
ENDCASE
CASE "2"
SET BAUD 1200 ; Do the update
ENDCASE
CASE "3"
SET BAUD 2400 ; Do the update
ENDCASE
CASE "4"
SET BAUD 9600 ; Do the update
ENDCASE
CASE "5"
SET BAUD 19.2 ; Do the update
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Speed
ENDCASE
ENDSWITCH
RETURN ; And continue
;
; ----- Subroutine: Type -> Select the modem type we'll use
;
Type:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " Modem type "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "When COM-AND created its defaults, modem commands were set to simple Hayes"
MESS "(tm) commands. You may select from one of the following modem types for"
MESS "default values. [This list is hardly comprehensive. If your particular"
MESS "modem is not listed, and you wish to change the modem commands, please use"
MESS "setup (Alt-S) in CRT mode, and refer to your modem manual.]"
MESS " "
MESS "Select S)kip, or from below (1 through 6): "
CURSOR N1,N2
MESS " "
MESS " 1) MICROCOM 9624c"
MESS " 2) Everex 2400 internal"
MESS " 3) Leading Edge 2400B half-size internal"
MESS " 4) Practical Peripherals 2400 half-size internal"
MESS " 5) Everex, Evercom 24+ (MNP)"
MESS " 6) Original default commands (Hayes compatible)"
MESS " "
MESS "Alt-S may be used at any time in CRT mode to change default values. You"
MESS "will need to know: 1) modem initialization command, 2) dialing command (pre-"
MESS "fix and suffix), 3) modem CONNECT string and 4) modem hangup command. Other"
MESS "settings controlling the modem may be made in Alt-O (options)."
;
; Wait for a keypress
;
LOCATE N1,N2 ; Relocate cursor
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "S" ; Skip
ENDCASE
CASE "1" ; MICROCOM 9624c
SET MINIT "ATE1\C1\G0\J1\K5\N3\Q0&T5\V1V1\X1S0=0!"
SET DPREF "AT\N3DT"
SET DSUFF "!"
SET DROPDTR ON
ENDCASE
CASE "2" ; Everex 2400 internal
SET MINIT "AT&D2S7=60!"
SET DROPDTR ON
ENDCASE
CASE "3" ; Leading Edge 2400B half-size internal
SET MINIT "ATS7=60X3!"
SET DROPDTR ON
ENDCASE
CASE "4" ; Practical Peripherals 2400 half-size internal
SET MINIT "AT&C1&D2L0X3!"
SET DROPDTR ON
ENDCASE
CASE "5" ; Everex, Evercom 24+ (MNP)
SET MINIT "AT\N3\Q1\K5\V1\X1\C1!"
SET DPREF "AT\N3DT"
SET DSUFF "!"
SET DROPDTR ON
ENDCASE
CASE "6" ; Hayes compatible
SET MINIT "ATE0 S7=250 V1 X0 S11=55!"
SET DPREF "ATDT"
SET DSUFF "!"
SET MCONN "CONNECT"
SET MHANG "ATH0!"
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Type
ENDCASE
ENDSWITCH
RETURN ; And continue
;
; ----- Subroutine: Download -> Select default download directory
;
Update:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " Update "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "The INSTALL script is now complete. You may press ESC at this point to can-"
MESS "cel any settings you have made, and later invoke INSTALL with F2 (Scripts)."
MESS " "
MESS "You may run through the installation again if you wish. Otherwise, changes"
MESS "made here will be saved for COM-AND this session and in future sesions."
MESS " "
MESS "Select A)gain, U)pdate, or ESCape (escape cancels this script): "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "A" ; A)gain
SET SUCCESS OFF
ENDCASE
CASE "U" ; U)pdate
SET SUCCESS ON
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Update
ENDCASE
ENDSWITCH
RETURN ; And continue
;
; ----- Subroutine: Coda -> last words.
;
Coda:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " INSTALL Coda "
LOCATE 2,2
MESS "The following manual keys may be used to set default values for COM-AND:"
MESS " "
MESS " Alt-S: Default values (modem strings, files, and constant values)"
MESS " Alt-O: Option settings (modem, display and programmatic flags)"
MESS " Alt-P: Communication parameters (speed, data/stop bits, parity, port)"
MESS " Alt-J: Menu, text and status bar color choices"
MESS " F4: Default download subdirectory (unqualified downloads)"
MESS " "
MESS "To dial a number, you must setup at least one dialing directory entry."
MESS "After INSTALL, use the Alt-D key to call up the dialing directory, and"
MESS "the 'r'subcommand to revise an entry. Once the entry has been revised,"
MESS "dial it through Alt-D by its entry number."
MESS " "
MESS "There are two other directories that may be setup, F1 (accessories) and"
MESS "Alt-M (macros). However, these do not need to be setup immediately."
MESS " "
MESS "Please refer to the document COM-AND.DOC provided with this release for"
MESS "a discussion of all the manual functions available. A summary of key"
MESS "commands, too, may be invoked in CRT mode at any time by pressing F10."
MESS " "
MESS "Press any key to terminate"
;
; Wait for a keypress
;
KEYGET S0 ; Wait for a char
RETURN ; And continue