home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / n / newscr.zip / NEWSCR.EXE / CSERVE.SCR < prev    next >
Text File  |  1993-02-05  |  4KB  |  156 lines

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