home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_1_1994.iso / 00190 / s / scripts.lib / CSERVE.SCR < prev    next >
Text File  |  1993-08-18  |  4KB  |  175 lines

  1. !
  2. !  Copyright (c) 1993
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CSERVE:
  9. !    Connect to CIS.
  10. !    First argument is %TRUE if direct connect and %FALSE otherwise
  11. !    Success:  returns %Success
  12. !    Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !        or %Fatal (depending on severity).
  14. !
  15. !+V
  16. ! "3.1"
  17. !-V
  18.  
  19. DirectConnect = Arg1;
  20. show "Connecting to CompuServe Network";
  21. Tries = 7;
  22. on cancel goto Return_Cancel;
  23. FirstTry = %TRUE;
  24. FailStr = "";
  25. ETX = "^C";
  26. CompuServeHost = "CPS^M";
  27. ifndef %X121Address = "";
  28. ifndef %OKCmd = "";
  29. ifndef %StopAtHost = "";
  30.  
  31. Start_Connect:
  32.     if Tries = 0 goto CIS_Failure;
  33.     Tries = Tries - 1;
  34.  
  35. Connect_Wait:
  36.     wait
  37.         "UIC:"        goto Send_ETX,
  38.         "Host Name:"    goto Send_Host_Name,
  39.         "User ID:"    goto Send_ID,
  40.         "Password:"    goto Send_Password,
  41.         "XPAD"        goto Send_XPAD
  42.     until 80;
  43.  
  44.     if not DirectConnect goto Send_CR;
  45.     sendm "###";
  46.  
  47. Send_CR:
  48.     send %CR;
  49.     goto Start_Connect;
  50.  
  51. Send_ETX:
  52.     send ETX;
  53.     goto Connect_Wait;
  54.  
  55. Send_Host_Name:
  56.     if Arg2 goto No_Wait;
  57.     wait until 10;
  58. No_Wait:
  59.     if %StopAtHost = "" goto Send_No_Stop;
  60.     if %StopAtHost = "1" goto Return_Success;
  61.     send CompuServeHost;
  62.     goto Return_Success;
  63.  
  64. Send_No_Stop:
  65.     send CompuServeHost;
  66.     goto Connect_Wait;
  67.  
  68. Send_ID:
  69.     show "Logging onto CompuServe";
  70.     send %UserID & %LogonParams & "/INT\" & %Password & %CR;
  71.     goto Logon_Wait;
  72.  
  73. Send_XPAD:
  74.     send %X121Address & %CR;
  75.     goto Connect_Wait;
  76.  
  77. Send_Password:
  78.     send %Password;
  79.  
  80. Logon_Wait:
  81.     wait
  82.         "CompuServe"    goto Return_Success,
  83.         "^[[>"        goto Return_Success,
  84.         "^F"        goto Return_Success,
  85.         "? LOG"        goto Process_Log_Msg,
  86.         "??LOG"        goto Process_Log_Msg,
  87.         " NTW"        goto Logon_Failure,
  88.         "OK^M"        goto Send_OK_Cmd,
  89.         "^[I"        goto Send_Response
  90.     until 200;
  91.  
  92.     goto CIS_Failure;
  93.  
  94. Process_Log_Msg:
  95.     wait
  96.         "INE"    goto Bad_ID,
  97.         "ISX"    goto Bad_ID_Syntax,
  98.         "CAI"    goto Cannot_Auto_Irun,
  99.         "SIL"    goto System_Unavailable,
  100.         "SIU"    goto System_Unavailable,
  101.         "SNA"    goto System_Unavailable,
  102.         "STU"    goto System_Unavailable,
  103.         "UTL"    goto Too_Many_Users
  104.     until 50;
  105.  
  106.     goto Try_Again;
  107.  
  108. Too_Many_Users:
  109.     define %FailureMsg = "Simultaneous users exceeded";
  110.     exit %Failure;
  111.  
  112. Cannot_Auto_Irun:
  113.     define %FailureMsg = "Cannot Auto Irun HMI server";
  114.     exit %Failure;
  115.  
  116. Bad_ID:
  117.     FailStr = "Incorrect User ID or password";
  118.     goto Try_Again;
  119.  
  120. Bad_ID_Syntax:
  121.     FailStr = "Incorrect User ID syntax";
  122.     goto Try_Again;
  123.  
  124. System_Unavailable:
  125.     define %FailureMsg = "The system is unavailable, try again later";
  126.     exit %Fatal;
  127.  
  128. Try_Again:
  129.     if not FirstTry goto CIS_Fatal;
  130.     send ETX;
  131.     FirstTry = %FALSE;
  132.  
  133.     wait
  134.         "User ID"    goto Send_ID
  135.     until 140;
  136.  
  137.     goto CIS_Fatal;
  138.  
  139. Logon_Failure:
  140.     define %FailureMsg = "Remote is busy or unavailable";
  141.     exit %Fatal;
  142.  
  143. Send_OK_Cmd:
  144.     if %OKCmd = "" goto Logon_Wait;
  145.     send %OKCmd & %CR;
  146.     goto Logon_Wait;
  147.  
  148. Send_Response:
  149.     sendi %ESCIResponse;
  150.     exit %Success;
  151.  
  152. CIS_Failure:
  153.     if FailStr <> "" goto Return_Fail_Msg;
  154.     define %FailureMsg = "Unable to connect to CompuServe host";
  155.     exit %Failure;
  156.  
  157. CIS_Fatal:
  158.     if FailStr <> "" goto Return_Fatal_Msg;
  159.     define %FailureMsg = "Unable to connect to CompuServe host";
  160.     exit %Fatal;
  161.  
  162. Return_Fail_Msg:
  163.     define %FailureMsg = FailStr;
  164.     exit %Failure;
  165.  
  166. Return_Fatal_Msg:
  167.     define %FailureMsg = FailStr;
  168.     exit %Fatal;
  169.  
  170. Return_Success:
  171.     exit %Success;
  172.  
  173. Return_Cancel:
  174.     exit %Cancel;
  175.