Cover V05, I06
Article
Figure 1
Listing 1
Listing 2
Listing 3
Sidebar 1
Sidebar 2

jun96.tar


Listing 2: Reflection sign-on script

;==========================================================
; HP3000.RCL - Version 1.1 - (c) 1996 by Steve Johnson. -
;   Roncis, Inc. - 909-594-0013
; HP3000 logon script for Reflection for DOS+
; Script uses Novell LAN Workplace for DOS TCP/IP stack
;   (TCPIP.EXE)
; Documentation - Script for scan the NET.CFG file to obtain
;   the workstation's IP address.  If an IP address is
;   found,it is used as the "Username" on the HP3000 Telnet
;   Server Session. The file HP3000.ADR is expected to
;   contain the IP address(es) of the HP3000 host.  Each
;   line of this file should contain an IP address.  The
;   script reads a line from this file and attempts to
;   establish a session with one of the HP3000 Telnet
;   Servers.  If a session is not available, another line
;   is read from the address file, and another session is
;   attempted.
;==========================================================
; Variables - V1 - General message processing
;             V2 - Address file found flag
;             V4 - IP address variable
;             V6 - Host input processing variable
;             V7 - Connected to Telnet Server flag
;==========================================================

let V7 = "NO"

set quiet-command yes
set disconnect-on-exit yes

;===Find Workstation IP Address ===
;---Make sure there is a net.cfg file
if not exist("c:\\nwclient\\net.cfg")
let V1 = "NetCfg_Not_Fnd"
goto continue_1
endif
open c:\nwclient\net.cfg input as 2
:read_net_cfg
;---Scan Netware Config file for 'IP_ADDRESS' line
if not eof(2)
read 2 V1
;---Remove excess spaces and convert to uppercase
let V1 = PACK(V1)
let V1 = UPPER(V1)
if mid(V1,2,11) = "IP_ADDRESS"
close 2
;---Strip off statement identifier
let V1 = mid(V1,13,99)
;---Strip off End-of-line characters
let V1 = mid(V1,1,length(V1)-2)
else
;---Didn't find it so get another line
goto read_net_cfg
endif
else
;---Didn't find and IP address, so use a dummy value
close 2
let V1 = "Unknown"
endif

:continue_1
display "Workstation IP Address = " & V1 & "^m^j"
;===End of Workstation IP Address Routine===

if not exist("HP3000.ADR")
display "^m^j^j"
display "Your workstation does not have a copy ^m^j"
display "of HP3000 address file, HP3000.ADR.^m^j"
display "Please call Technical Support to obtain a^m^j"
display "copy of this file.  In the meantime, if^m^j"
display "you know the address for the HP3000^m^j"
display " please enter it now.  Otherwise, press ^m^j"
display "<ALT><X> to exit.^m^j^j"
display "   IP Address> "
accept 0:0:30 V4
if not found
exit
endif
let V2 = "NO"
goto try_address
else
let V2 = "YES"
endif

open HP3000.ADR input as 1

:read_address
if V2 = "NO"
goto no_sessions
endif

if eof(1)
close 1
goto no_sessions
endif

;---Read line from Address File, format=xxx.xxx.xxx.xxx
;---where the xxx.xxx.xxx.xxx is a valid IP address.
read 1 V4
if length(V4) < 5
goto read_address
endif

;---Send connect command with IP address
:try_address
transmit "connect $4^m"

;---Look for password request
wait 0:0:3 for "password> "
;---If not found, disconnect and try again
if not found
display "Session Timeout"
disconnect
transmit "^m"
wait 0:0:5 for "CON-MGR> "
if found
goto read_address
else
goto not_avail
endif
endif

;---Send stock password
transmit "HP3000^m"

:readhost
;---See how the server responds
readhost 10 V6 until " "
;---If nothing is received in 10 seconds,
;--- kill the session and try again
if not found
display "Session Timeout"
disconnect
transmit "^m"
wait 0:0:20 for "CON-MGR> "
goto read_address
else
let V7 = "YES"
;display "****" & V6 & "****^m^j"
;wait 0:0:5
;---Server is requesting workstation ID,
;--- so send IP address found above
if mid(V6,5,12) = "Username"
transmit "$1 ^m"
readhost 2 V6 until " "
;---Loop around to grab next line from server
goto readhost
endif
;---Server is ready to work, goto the
;--- "Connected" Banner display
if mid(V6,5,14) = "Connecting"
goto connected
endif
;---Problem: probably out of sessions,
;--- try again with another server
if mid(V6,5,10) = "%Error"
disconnect
wait 0:0:20 for "CON-MGR> "
goto read_address
endif
;---Catch the unanticipated response, but give
;--- them the session if available
mclear
display "Host response not found^m^j"
display "Please call Tech Support^m^j"
display "***" & V6 & "***^m^j^j^j"
transmit "^m"
stop
endif

:no_sessions
if V7 = "NO"
goto not_avail
endif
mclear
display "All ports on the HP3000 are in use.^m^j"
display "Please try again at a later time.^m^j"
display '^j    To exit press <ALT><X>^m^j^j'
wait 0:0:30
exit
stop

:not_avail
display "^m^j^j"
display "Unable to attach to the HP3000 due to a^m^j"
display "network problem.  Please call tech support^m^j"
display "for assistance, or try again at a later time.^j"
display '^j         To exit press <ALT><X>^m^j^j'
wait 0:0:30
exit
stop

:connected
wait 0:0:3 for "~>."
mclear
display "      Attached to HP3000.^m^j"
display '^jTo sign-off, type "BYE" at the colon prompt,^m^j'
display " then press <ALT><X>^m^j^j'
transmit "^m"
if V2 = "YES"
close 1
endif
stop