home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / XTALK1.ZIP / R2LOGIN.XWS < prev    next >
Encoding:
Text File  |  1990-04-30  |  5.0 KB  |  153 lines

  1. /*
  2.     Remote2 Host/R2LAN Host Login Script
  3.  
  4.     R2LOGIN logs you into a system running either Remote2 Host
  5.     or R2LAN Host.  The script will wait for the host's return
  6.     call if you are using the Call-Back feature.
  7.  
  8.     This script is loaded into the Script session variable by
  9.     the NEWCALL script if you use NEWCALL to create a Remote2
  10.     phone book entry.  NEWCALL will also program the function
  11.     keys to contain their Remote2 keyboard mapping values.
  12.  
  13.     The Remote2 keyboard mapping is listed in Appendix D of your
  14.     Remote2 Host manual.  You must use the escape sequences for
  15.     some keys; Appendix D lists these escape sequences for you.
  16.  
  17.     Copyright (C) 1989, 1990 Digital Communications Associates, Inc.
  18.     All rights reserved.
  19.  
  20.     Version 1.00 07-01-89 PJL (from R2LOGIN.XTS)
  21. */
  22.  
  23.         string xws_name
  24.         xws_name = ''
  25.  
  26.  
  27.         -- check Terminal type
  28.         if Terminal = 'VT-102' then ttype = '10'
  29.         else if Terminal = 'IBM-PC' then ttype = '3'
  30.         else Terminal = 'VT-102' : ttype = '10'
  31.  
  32.         display off
  33.         trap on : e = error
  34.         if null(NetID) then goto WAKEUP
  35.  
  36. -- send R2LAN NetID:
  37.         message "  Sending R2LAN NetID ..."
  38.         trys = 0
  39. label DEST_NAME
  40.         trys = trys + 1
  41.         watch 10 seconds for
  42.                 "NAME"       : reply NetID
  43.                 "PROCEED"    : goto WAKEUP
  44.                 "WAIT",
  45.                 "ATTEMPTING" : goto NET_WAIT
  46.                 "DISCONNECT" : while online : wend : e = error
  47.         endwatch
  48.         if not online then {
  49.                 alert "R2LAN NetID rejected.  Check value with LAN administrator.", OK
  50.                 goto R2_END
  51.         }
  52.         reply
  53.         goto DEST_NAME
  54.  
  55. label NET_WAIT
  56.         watch for
  57.                 "PROCEED"     : goto WAKEUP
  58.                 "NOT AVAIL"   : if trys < 3 then wait 20 seconds : goto DEST_NAME
  59.                 "no LAN work" : 
  60.         endwatch
  61.         alert "Communications server unavailable.  Try again later.", OK
  62.         goto R2_END
  63.  
  64. -- wake up host:
  65. label WAKEUP
  66.         message "  Connected ... waking up host ..."
  67.         trys = 1
  68.         repeat
  69.                 reply
  70.                 watch 2 seconds for
  71.                         "User ID:" : goto LOGIN
  72.                 endwatch
  73.                 if not online then trys = 6
  74.                 else trys = trys + 1
  75.         until trys > 5
  76.         -- host didn't respond
  77.         alert "The Host system is not responding.  Try again later.", OK
  78.         goto R2_END
  79.  
  80. -- send UserID and Password:
  81. label LOGIN
  82.         -- put all login info into one string
  83.         r2info = UserID + ";" + Password
  84.         if length(AnswerBack) then r2info = r2info + ";" + AnswerBack
  85.         message "  Sending login information ..."
  86.         trys = 1
  87.         reply r2info
  88. label SEND_INFO
  89.         watch for
  90.                 "in.",">" : goto DONE
  91.                 "ID:"     : reply r2info : trys = trys + 1
  92.                 "Invalid" : while online : wend : e = error
  93.         endwatch
  94.         if online and trys <= 3 then goto SEND_INFO
  95.         -- Bad login:
  96.         alert "Login rejected.  Check login values with Host administrator.", OK
  97.         goto R2_END
  98.  
  99. -- allow for possible callback:
  100. label DONE
  101.         message "  Logged in ... please wait ..."
  102.         watch 4 seconds for
  103.                 "Phone number" : goto NO_CBNUM
  104.                 "Disconnect"   : goto CALL_BACK
  105.                 "erminal type" : wait 2 seconds : reply ttype
  106.         endwatch
  107.         goto R2_END
  108.  
  109. label NO_CBNUM
  110.         wait 5 ticks
  111.         cbnum = ""
  112.         message "  Need CallBack number"
  113.         DialogBox 59, 20, 200, 80
  114.            LText        6,  6, 188,  8, "The Host is requesting a CallBack phone number."
  115.            LText        6, 20, 184,  8, "Please enter the phone number for your system."
  116.            EditText     6, 40, 164, 12, "", cbnum, TABSTOP
  117.            PushButton  44, 60,  36, 14, "Ok", OK TABSTOP
  118.            PushButton 120, 60,  36, 14, "Cancel", CANCEL TABSTOP
  119.         EndDialog
  120.         if choice = 2 then goto R2_END
  121.         message "  Sending CallBack number ..."
  122.         reply cbnum
  123.  
  124.  
  125. label CALL_BACK
  126.         e = error
  127.         while online : wend
  128.         e = error
  129.         xws_name = Script : Script = ""
  130.  
  131.         -- set modem to answer the phone if not in local mode
  132.         if local = off then {
  133.                 message "  Initializing the modem ..."
  134.                 wait 5 ticks : go
  135.                 wait 5 ticks : reply
  136.                 wait 5 ticks : reply modeminit
  137.                 wait 5 ticks : reply answersetup
  138.         }
  139.  
  140.         -- wait for Remote2 to call back
  141.         message "  Waiting for Remote2 callback ..."
  142.         watch 5 minutes for
  143.                 ">" : goto R2_END
  144.                 "erminal type" : wait 2 seconds : reply ttype : goto R2_END
  145.         endwatch
  146.         alert "The Host system is not returning your call.", OK
  147.  
  148. label R2_END
  149.         message ""
  150.         if length(xws_name) then Script = xws_name
  151.         capture off
  152.         end
  153.