home *** CD-ROM | disk | FTP | other *** search
- /*
- Remote2 Host/R2LAN Host Login Script
-
- R2LOGIN logs you into a system running either Remote2 Host
- or R2LAN Host. The script will wait for the host's return
- call if you are using the Call-Back feature.
-
- This script is loaded into the Script session variable by
- the NEWCALL script if you use NEWCALL to create a Remote2
- phone book entry. NEWCALL will also program the function
- keys to contain their Remote2 keyboard mapping values.
-
- The Remote2 keyboard mapping is listed in Appendix D of your
- Remote2 Host manual. You must use the escape sequences for
- some keys; Appendix D lists these escape sequences for you.
-
- Copyright (C) 1989, 1990 Digital Communications Associates, Inc.
- All rights reserved.
-
- Version 1.00 07-01-89 PJL (from R2LOGIN.XTS)
- */
-
- string xws_name
- xws_name = ''
-
-
- -- check Terminal type
- if Terminal = 'VT-102' then ttype = '10'
- else if Terminal = 'IBM-PC' then ttype = '3'
- else Terminal = 'VT-102' : ttype = '10'
-
- display off
- trap on : e = error
- if null(NetID) then goto WAKEUP
-
- -- send R2LAN NetID:
- message " Sending R2LAN NetID ..."
- trys = 0
- label DEST_NAME
- trys = trys + 1
- watch 10 seconds for
- "NAME" : reply NetID
- "PROCEED" : goto WAKEUP
- "WAIT",
- "ATTEMPTING" : goto NET_WAIT
- "DISCONNECT" : while online : wend : e = error
- endwatch
- if not online then {
- alert "R2LAN NetID rejected. Check value with LAN administrator.", OK
- goto R2_END
- }
- reply
- goto DEST_NAME
-
- label NET_WAIT
- watch for
- "PROCEED" : goto WAKEUP
- "NOT AVAIL" : if trys < 3 then wait 20 seconds : goto DEST_NAME
- "no LAN work" :
- endwatch
- alert "Communications server unavailable. Try again later.", OK
- goto R2_END
-
- -- wake up host:
- label WAKEUP
- message " Connected ... waking up host ..."
- trys = 1
- repeat
- reply
- watch 2 seconds for
- "User ID:" : goto LOGIN
- endwatch
- if not online then trys = 6
- else trys = trys + 1
- until trys > 5
- -- host didn't respond
- alert "The Host system is not responding. Try again later.", OK
- goto R2_END
-
- -- send UserID and Password:
- label LOGIN
- -- put all login info into one string
- r2info = UserID + ";" + Password
- if length(AnswerBack) then r2info = r2info + ";" + AnswerBack
- message " Sending login information ..."
- trys = 1
- reply r2info
- label SEND_INFO
- watch for
- "in.",">" : goto DONE
- "ID:" : reply r2info : trys = trys + 1
- "Invalid" : while online : wend : e = error
- endwatch
- if online and trys <= 3 then goto SEND_INFO
- -- Bad login:
- alert "Login rejected. Check login values with Host administrator.", OK
- goto R2_END
-
- -- allow for possible callback:
- label DONE
- message " Logged in ... please wait ..."
- watch 4 seconds for
- "Phone number" : goto NO_CBNUM
- "Disconnect" : goto CALL_BACK
- "erminal type" : wait 2 seconds : reply ttype
- endwatch
- goto R2_END
-
- label NO_CBNUM
- wait 5 ticks
- cbnum = ""
- message " Need CallBack number"
- DialogBox 59, 20, 200, 80
- LText 6, 6, 188, 8, "The Host is requesting a CallBack phone number."
- LText 6, 20, 184, 8, "Please enter the phone number for your system."
- EditText 6, 40, 164, 12, "", cbnum, TABSTOP
- PushButton 44, 60, 36, 14, "Ok", OK TABSTOP
- PushButton 120, 60, 36, 14, "Cancel", CANCEL TABSTOP
- EndDialog
- if choice = 2 then goto R2_END
- message " Sending CallBack number ..."
- reply cbnum
-
-
- label CALL_BACK
- e = error
- while online : wend
- e = error
- xws_name = Script : Script = ""
-
- -- set modem to answer the phone if not in local mode
- if local = off then {
- message " Initializing the modem ..."
- wait 5 ticks : go
- wait 5 ticks : reply
- wait 5 ticks : reply modeminit
- wait 5 ticks : reply answersetup
- }
-
- -- wait for Remote2 to call back
- message " Waiting for Remote2 callback ..."
- watch 5 minutes for
- ">" : goto R2_END
- "erminal type" : wait 2 seconds : reply ttype : goto R2_END
- endwatch
- alert "The Host system is not returning your call.", OK
-
- label R2_END
- message ""
- if length(xws_name) then Script = xws_name
- capture off
- end
-